Jump to content

code for autoreply


dream25

Recommended Posts

Hi... if anyone going to send an email...to my id... if i recieve that mail i wanna to send a autoreply mail... actually i have the code for sending mail... below..
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "localhost"; // SMTP server
$mail->From = "[email protected]";
$mail->AddAddress("[email protected]");

$mail->Subject = "first mailing";
$mail->Body = "hi ! \n\n this is First mailing I made myself with PHPMailer !";
$mail->WordWrap = 50;

if(!$mail->Send())
{
  echo "Message was not sent";
  echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
  echo "Message has been sent";
}
?>
Link to comment
https://forums.phpfreaks.com/topic/35191-code-for-autoreply/
Share on other sites

THIS SCRIPT REPLIES ON BEING FED BY A FORM WITH ONE CRITICAL FIELD WHICH IS EMAIL. THIS IS HOW THE FORM KNOWS

WHERE TO SEND THE AUTORESPONDER TO.

THE FORM SHOULD LOOK SOMETHING LIKE THIS
<form action="script.php" method="post">
<input type="text" name="email">
<input type="submit">
</form>

[code]
//Autoresponder
$mailto="$email";
$subject="SUBJECT LINE";
$body.="Thank you for contacting us.\n";
$body.="We will get back to you shortly.\n";
mail($mailto,$subject,$body,"From: WHO THE MESSAGE IS FROM\n");

//Mail to admin
$mailto="[email protected]";
$subject="SUBJECT LINE";
$body1.="You have been sent the following message.\n";
$body1.="Name: $your_name\n";
mail($mailto,$subject,$body1,"From: WHO THE MESSAGE IS FROM\n");[/code]
Link to comment
https://forums.phpfreaks.com/topic/35191-code-for-autoreply/#findComment-166193
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.