Now in own repository for remote checkouts
[core.git] / inc / classes / third_party / php_mailer / examples / test_mail.php
1 <?php\r
2 \r
3 include_once('../class.phpmailer.php');\r
4 \r
5 $mail             = new PHPMailer(); // defaults to using php "mail()"\r
6 \r
7 $body             = $mail->getFile('contents.html');\r
8 $body             = eregi_replace("[\]",'',$body);\r
9 \r
10 $mail->From       = "name@yourdomain.com";\r
11 $mail->FromName   = "First Last";\r
12 \r
13 $mail->Subject    = "PHPMailer Test Subject via mail()";\r
14 \r
15 $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test\r
16 \r
17 $mail->MsgHTML($body);\r
18 \r
19 $mail->AddAddress("whoto@otherdomain.com", "John Doe");\r
20 \r
21 $mail->AddAttachment("images/phpmailer.gif");             // attachment\r
22 \r
23 if(!$mail->Send()) {\r
24   echo "Mailer Error: " . $mail->ErrorInfo;\r
25 } else {\r
26   echo "Message sent!";\r
27 }\r
28 \r
29 ?>\r