3 //error_reporting(E_ALL);
4 error_reporting(E_STRICT);
6 date_default_timezone_set('America/Toronto');
8 include("class.phpmailer.php");
9 //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
11 $mail = new PHPMailer();
13 $body = $mail->getFile('contents.html');
14 $body = eregi_replace("[\]",'',$body);
17 $mail->SMTPAuth = true; // enable SMTP authentication
18 $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
19 $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
20 $mail->Port = 465; // set the SMTP port for the GMAIL server
22 $mail->Username = "yourusername@gmail.com"; // GMAIL username
23 $mail->Password = "yourpassword"; // GMAIL password
25 $mail->AddReplyTo("yourusername@gmail.com","First Last");
27 $mail->From = "name@yourdomain.com";
28 $mail->FromName = "First Last";
30 $mail->Subject = "PHPMailer Test Subject via gmail";
32 //$mail->Body = "Hi,<br>This is the HTML BODY<br>"; //HTML Body
33 $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
34 $mail->WordWrap = 50; // set word wrap
36 $mail->MsgHTML($body);
38 $mail->AddAddress("whoto@otherdomain.com", "John Doe");
40 $mail->AddAttachment("images/phpmailer.gif"); // attachment
42 $mail->IsHTML(true); // send as HTML
45 echo "Mailer Error: " . $mail->ErrorInfo;