phpmailer一个非常好的php发邮件类



[复制到剪切板]
CODE:
<?php
/*
    Description:php发邮件类
    Author: 宝宝
    Date: 2008-12-31
    From: [url]www.seoyou.cn[/url]  phper forum phper家园
    Remark: This file is only for study. 
*/
// example on using PHPMailer with GMAIL

include("class.phpmailer.php");
include(
"class.smtp.php");

$mail=new PHPMailer();

$mail->IsSMTP();
$mail->SMTPAuth  true;                  // enable SMTP authentication
$mail->SMTPSecure "ssl";                // sets the prefix to the servier
$mail->Host      "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port      465;                  // set the SMTP port

$mail->Username  "Gmail帐号";  // GMAIL username
$mail->Password  "密码";            // GMAIL password

$mail->From      "[email][email protected][/email]";
$mail->FromName  "phper家园";
$mail->Subject    "宝宝祝你新年快乐 , <[url]www.seoyou.cn[/url]>";
$mail->Body      file_get_contents("[url]http://www.seoyou.net"[/url]);                      //HTML Body
$mail->AltBody    "Hi,真的祝你新年快乐"//Text Body

$mail->WordWrap  50// set word wrap

$mail->AddAddress("[email][email protected][/email]","First Last");
$mail->AddReplyTo("[email][email protected][/email]","Webmaster");
//$mail->AddAttachment("/path/to/file.zip");            // attachment
$mail->AddAttachment("[img]http://www.seoyou.net/seoyou.jpg[/img]""宝宝的照片.jpg"); // attachment

$mail->IsHTML(true); // send as HTML

    
if(!$mail->Send()) {
      echo 
"Mailer Error: " $mail->ErrorInfo;
    } else {
      echo 
"Message has been sent";
    }

?>

转子 ;

:http://www.seoyou.cn/read.php?tid=276