Code syncronized with shipsimu code base
[mailer.git] / inc / classes / third_party / php_mailer / examples / test_gmail.php
diff --git a/inc/classes/third_party/php_mailer/examples/test_gmail.php b/inc/classes/third_party/php_mailer/examples/test_gmail.php
new file mode 100644 (file)
index 0000000..4592efc
--- /dev/null
@@ -0,0 +1,50 @@
+<?php\r
+\r
+//error_reporting(E_ALL);\r
+error_reporting(E_STRICT);\r
+\r
+date_default_timezone_set('America/Toronto');\r
+\r
+include("class.phpmailer.php");\r
+//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded\r
+\r
+$mail             = new PHPMailer();\r
+\r
+$body             = $mail->getFile('contents.html');\r
+$body             = eregi_replace("[\]",'',$body);\r
+\r
+$mail->IsSMTP();\r
+$mail->SMTPAuth   = true;                  // enable SMTP authentication\r
+$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier\r
+$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server\r
+$mail->Port       = 465;                   // set the SMTP port for the GMAIL server\r
+\r
+$mail->Username   = "yourusername@gmail.com";  // GMAIL username\r
+$mail->Password   = "yourpassword";            // GMAIL password\r
+\r
+$mail->AddReplyTo("yourusername@gmail.com","First Last");\r
+\r
+$mail->From       = "name@yourdomain.com";\r
+$mail->FromName   = "First Last";\r
+\r
+$mail->Subject    = "PHPMailer Test Subject via gmail";\r
+\r
+//$mail->Body       = "Hi,<br>This is the HTML BODY<br>";                      //HTML Body\r
+$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test\r
+$mail->WordWrap   = 50; // set word wrap\r
+\r
+$mail->MsgHTML($body);\r
+\r
+$mail->AddAddress("whoto@otherdomain.com", "John Doe");\r
+\r
+$mail->AddAttachment("images/phpmailer.gif");             // attachment\r
+\r
+$mail->IsHTML(true); // send as HTML\r
+\r
+if(!$mail->Send()) {\r
+  echo "Mailer Error: " . $mail->ErrorInfo;\r
+} else {\r
+  echo "Message sent!";\r
+}\r
+\r
+?>\r