文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>phpmailer(Full featured email transfer class for )

phpmailer(Full featured email transfer class for )

时间:2005-12-06  来源:manbuzhe0301

Here's a complex example of sending an HTML email with SMTP
authentication and attachments
来自:
sourceforge.net:
    
Communications
               

 
Email
                     

  Mail Transport Agents
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();                                   // send via SMTP
$mail->Host     = "smtp1.site.com;smtp2.site.com"; // SMTP servers
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = "jswan";  // SMTP username
$mail->Password = "secret"; // SMTP password
$mail->From     = "[email protected]";
$mail->FromName = "Mailer";
$mail->AddAddress("[email protected]","Josh Adams");
$mail->AddAddress("[email protected]");               // optional name
$mail->AddReplyTo("[email protected]","Information");
$mail->WordWrap = 50;                              // set word wrap
$mail->AddAttachment("/var/tmp/file.tar.gz");      // attachment
$mail->AddAttachment("/tmp/image.jpg", "new.jpg");
$mail->IsHTML(true);                               // send as HTML
$mail->Subject  =  "Here is the subject";
$mail->Body     =  "This is the HTML body";
$mail->AltBody  =  "This is the text-only body";
if(!$mail->Send())
{
   echo "Message was not sent ";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}
echo "Message has been sent";

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载