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