test_sendmail.php
Go to the documentation of this file.00001 <?php
00002
00003
00004 error_reporting(E_STRICT);
00005
00006
00007 date_default_timezone_set('America/Toronto');
00008
00009
00010 include_once('class.phpmailer.php');
00011
00012 $mail = new PHPMailer();
00013 $body = $mail->getFile('contents.html');
00014 $body = eregi_replace("[\]",'',$body);
00015
00016 $mail->IsSendmail();
00017
00018 $mail->From = "name@yourdomain.com";
00019 $mail->FromName = "First Last";
00020
00021 $mail->Subject = "PHPMailer Test Subject via smtp";
00022
00023 $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
00024
00025 $mail->MsgHTML($body);
00026
00027 $mail->AddAddress("whoto@otherdomain.com", "John Doe");
00028
00029 $mail->AddAttachment("images/phpmailer.gif");
00030
00031 if(!$mail->Send()) {
00032 echo "Mailer Error: " . $mail->ErrorInfo;
00033 } else {
00034 echo "Message sent!";
00035 }
00036
00037 ?>