Return to Snippet

Revision: 42089
at February 26, 2011 21:25 by erraja_07


Initial Code
<?php
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                // send via SMTP
$mail->Host     = "smtp.domain.com"; // SMTP servers
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = "[email protected]";   // SMTP username
$mail->Password = "password"; // SMTP password

$mail->From     = "[email protected]";
$mail->FromName = "Name";
$mail->AddAddress("[email protected]","Name");
$mail->AddReplyTo("[email protected]","Your Name");

$mail->WordWrap = 50;                              // set word wrap
 
$mail->IsHTML(true);                               // send as HTML

$mail->Subject  =  "Here is the subject";
$mail->Body     =  "This is the <b>HTML body</b>";
$mail->AltBody  =  "This is the text-only body";

if(!$mail->Send())
{
   echo "Message was not sent <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "Message has been sent";

?>

Initial URL
http://www.vpsdiscussions.com/index.php/topic,111.0.html

Initial Description
Advance Mail function using PHP Mailer Class

Initial Title
PHP - Mailer Code

Initial Tags
mail, function

Initial Language
PHP