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