Continued with renaming-season:
[core.git] / framework / main / third_party / php_mailer / examples / test_sendmail.php
1 <?php
2
3 //error_reporting(E_ALL);
4 error_reporting(E_STRICT);
5
6
7 date_default_timezone_set('America/Toronto');
8 //date_default_timezone_set(date_default_timezone_get());
9
10 include_once('class.phpmailer.php');
11
12 $mail             = new PHPMailer();
13 $body             = $mail->getFile('contents.html');
14 $body             = eregi_replace("[\]",'',$body);
15
16 $mail->IsSendmail(); // telling the class to use SendMail transport
17
18 $mail->From       = "name@yourdomain.com";
19 $mail->FromName   = "First Last";
20
21 $mail->Subject    = "PHPMailer Test Subject via smtp";
22
23 $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
24
25 $mail->MsgHTML($body);
26
27 $mail->AddAddress("whoto@otherdomain.com", "John Doe");
28
29 $mail->AddAttachment("images/phpmailer.gif");             // attachment
30
31 if(!$mail->Send()) {
32   echo "Mailer Error: " . $mail->ErrorInfo;
33 } else {
34   echo "Message sent!";
35 }
36
37 ?>