source: hadoop-register/etc/phpMailer/examples/test_sendmail.php @ 192

Last change on this file since 192 was 57, checked in by jazz, 16 years ago
  • 第一版 Hadoop 叢集之帳號申請網頁 by Wade
File size: 968 bytes
Line 
1<?php
2
3//error_reporting(E_ALL);
4error_reporting(E_STRICT);
5
6
7date_default_timezone_set('America/Toronto');
8//date_default_timezone_set(date_default_timezone_get());
9
10include_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
31if(!$mail->Send()) {
32  echo "Mailer Error: " . $mail->ErrorInfo;
33} else {
34  echo "Message sent!";
35}
36
37?>
Note: See TracBrowser for help on using the repository browser.