3 include_once('class.phpmailer.php');
4 //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
6 $mail = new PHPMailer();
8 $body = $mail->getFile('contents.html');
9 $body = eregi_replace("[\]",'',$body);
11 $mail->IsSMTP(); // telling the class to use SMTP
12 $mail->Host = "mail.yourdomain.com"; // SMTP server
14 $mail->From = "name@yourdomain.com";
15 $mail->FromName = "First Last";
17 $mail->Subject = "PHPMailer Test Subject via smtp";
19 $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
21 $mail->MsgHTML($body);
23 $mail->AddAddress("whoto@otherdomain.com", "John Doe");
25 $mail->AddAttachment("images/phpmailer.gif"); // attachment
28 echo "Mailer Error: " . $mail->ErrorInfo;