source: hadoop-register/etc/phpMailer/examples/test_smtp.php @ 136

Last change on this file since 136 was 57, checked in by jazz, 16 years ago
  • 第一版 Hadoop 叢集之帳號申請網頁 by Wade
File size: 1.1 KB
Line 
1<?php
2
3//error_reporting(E_ALL);
4error_reporting(E_STRICT);
5
6date_default_timezone_set('America/Toronto');
7//date_default_timezone_set(date_default_timezone_get());
8
9include_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
33if(!$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.