]> git.mxchange.org Git - mailer.git/blob - inc/phpmailer/examples/test_smtp.php
More language constants rewritten ({--LANGUAGE--} is for constants)
[mailer.git] / inc / phpmailer / examples / test_smtp.php
1 <?php\r
2 \r
3 include_once('class.phpmailer.php');\r
4 //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded\r
5 \r
6 $mail             = new PHPMailer();\r
7 \r
8 $body             = $mail->getFile('contents.html');\r
9 $body             = eregi_replace("[\]",'',$body);\r
10 \r
11 $mail->IsSMTP(); // telling the class to use SMTP\r
12 $mail->Host       = "mail.yourdomain.com"; // SMTP server\r
13 \r
14 $mail->From       = "name@yourdomain.com";\r
15 $mail->FromName   = "First Last";\r
16 \r
17 $mail->Subject    = "PHPMailer Test Subject via smtp";\r
18 \r
19 $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test\r
20 \r
21 $mail->MsgHTML($body);\r
22 \r
23 $mail->AddAddress("whoto@otherdomain.com", "John Doe");\r
24 \r
25 $mail->AddAttachment("images/phpmailer.gif");             // attachment\r
26 \r
27 if(!$mail->Send()) {\r
28   echo "Mailer Error: " . $mail->ErrorInfo;\r
29 } else {\r
30   echo "Message sent!";\r
31 }\r
32 \r
33 ?>\r