Code syncronized with shipsimu code base
[mailer.git] / inc / classes / third_party / php_mailer / examples / test_gmail.php
1 <?php\r
2 \r
3 //error_reporting(E_ALL);\r
4 error_reporting(E_STRICT);\r
5 \r
6 date_default_timezone_set('America/Toronto');\r
7 \r
8 include("class.phpmailer.php");\r
9 //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded\r
10 \r
11 $mail             = new PHPMailer();\r
12 \r
13 $body             = $mail->getFile('contents.html');\r
14 $body             = eregi_replace("[\]",'',$body);\r
15 \r
16 $mail->IsSMTP();\r
17 $mail->SMTPAuth   = true;                  // enable SMTP authentication\r
18 $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier\r
19 $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server\r
20 $mail->Port       = 465;                   // set the SMTP port for the GMAIL server\r
21 \r
22 $mail->Username   = "yourusername@gmail.com";  // GMAIL username\r
23 $mail->Password   = "yourpassword";            // GMAIL password\r
24 \r
25 $mail->AddReplyTo("yourusername@gmail.com","First Last");\r
26 \r
27 $mail->From       = "name@yourdomain.com";\r
28 $mail->FromName   = "First Last";\r
29 \r
30 $mail->Subject    = "PHPMailer Test Subject via gmail";\r
31 \r
32 //$mail->Body       = "Hi,<br>This is the HTML BODY<br>";                      //HTML Body\r
33 $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test\r
34 $mail->WordWrap   = 50; // set word wrap\r
35 \r
36 $mail->MsgHTML($body);\r
37 \r
38 $mail->AddAddress("whoto@otherdomain.com", "John Doe");\r
39 \r
40 $mail->AddAttachment("images/phpmailer.gif");             // attachment\r
41 \r
42 $mail->IsHTML(true); // send as HTML\r
43 \r
44 if(!$mail->Send()) {\r
45   echo "Mailer Error: " . $mail->ErrorInfo;\r
46 } else {\r
47   echo "Message sent!";\r
48 }\r
49 \r
50 ?>\r