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