| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | //error_reporting(E_ALL); |
|---|
| 4 | error_reporting(E_STRICT); |
|---|
| 5 | |
|---|
| 6 | date_default_timezone_set('America/Toronto'); |
|---|
| 7 | //date_default_timezone_set(date_default_timezone_get()); |
|---|
| 8 | |
|---|
| 9 | include_once('class.phpmailer.php'); |
|---|
| 10 | //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded |
|---|
| 11 | |
|---|
| 12 | $mail = new PHPMailer(); |
|---|
| 13 | |
|---|
| 14 | $body = $mail->getFile('contents.html'); |
|---|
| 15 | $body = eregi_replace("[\]",'',$body); |
|---|
| 16 | |
|---|
| 17 | $mail->IsSMTP(); // telling the class to use SMTP |
|---|
| 18 | $mail->Host = "mail.worxteam.com"; // SMTP server |
|---|
| 19 | |
|---|
| 20 | $mail->From = "name@yourdomain.com"; |
|---|
| 21 | $mail->FromName = "First Last"; |
|---|
| 22 | |
|---|
| 23 | $mail->Subject = "PHPMailer Test Subject via smtp"; |
|---|
| 24 | |
|---|
| 25 | $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test |
|---|
| 26 | |
|---|
| 27 | $mail->MsgHTML($body); |
|---|
| 28 | |
|---|
| 29 | $mail->AddAddress("whoto@otherdomain.com", "John Doe"); |
|---|
| 30 | |
|---|
| 31 | $mail->AddAttachment("images/phpmailer.gif"); // attachment |
|---|
| 32 | |
|---|
| 33 | if(!$mail->Send()) { |
|---|
| 34 | echo "Mailer Error: " . $mail->ErrorInfo; |
|---|
| 35 | } else { |
|---|
| 36 | echo "Message sent!"; |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | ?> |
|---|
Note: See
TracBrowser
for help on using the repository browser.