• 1-888-289-2246
  • 24x7x365 Presence

Sample PHPMailer Script


To enable SMTP AUTH in PHPMailer:

First download the PHPMailer class file from the site http://phpmailer.sourceforge.net.

Save it as a php-file in the same directory as your script.

Include this script in your code:

require(“class.phpmailer.php”);
$mail = new PHPMailer();
$mail = new PHPMailer(); //Create PHPmailer class
$mail->From = “[email protected]”; //Sender address
$mail->FromName = “BUZZINESS WORLD “; //The name that you’ll see as Sender
$mail->Host = “mail.domain.com”; //Your SMTP mail server
$mail->Port = ‘587’;
$mail->Mailer = “smtp”; //Protocol to use
$mail->AddAddress(“[email protected]”); //The address you are sending mail to
$mail->Subject = “Mail Subject”; //Subject of the mail
$mail->Body = “Write your mail here”; //Body of the message
$mail->SMTPAuth = “true”;
$mail->Username = “[email protected]”; //valid email id of the domain
$mail->Password = “password”; //password for abc@xyz
if(!$mail->Send()){ //Check for result of sending mail
echo “There was an error sending the message”; //Write an error message if mail isn’t sent”
exit; //Exit the script without executing the rest of the code
}
echo “Your query has been sent”;
?>

]]>


Leave a Reply

Your email address will not be published. Required fields are marked *