3 include("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);
12 $mail->SMTPAuth = TRUE; // enable SMTP authentication
13 $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
14 $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
15 $mail->Port = 465; // set the SMTP port for the GMAIL server
17 $mail->Username = "yourusername@gmail.com"; // GMAIL username
18 $mail->Password = "yourpassword"; // GMAIL password
20 $mail->AddReplyTo("yourusername@gmail.com","First Last");
22 $mail->From = "name@yourdomain.com";
23 $mail->FromName = "First Last";
25 $mail->Subject = "PHPMailer Test Subject via gmail";
27 //$mail->Body = "Hi,<br>This is the HTML BODY<br>"; //HTML Body
28 $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
29 $mail->WordWrap = 50; // set word wrap
31 $mail->MsgHTML($body);
33 $mail->AddAddress("whoto@otherdomain.com", "John Doe");
35 $mail->AddAttachment("images/phpmailer.gif"); // attachment
37 $mail->IsHTML(TRUE); // send as HTML
40 echo "Mailer Error: " . $mail->ErrorInfo;