我一直在运行在Amazon Web Services的labs.9lessons.com工作。几天前,我已经通过PHP Mailer实现使用Amazon简单电子邮件服务SMTP完成电子邮件通知系统。我希望今天的PHP教程会为帮助你的web项目实现电子邮件通知系统。498)this.width=498;'' onmousewheel = ''javascript:return big(this)'' title="使用PHP实现Amazon简单邮件服务SMTP" alt="使用PHP实现Amazon简单邮件服务SMTP" src="/uploadfile/201301/2/C019597568.png" /> 使用PHP实现Amazon简单邮件服务SMTP498)this.width=498;'' onmousewheel = ''javascript:return big(this)'' height="427" alt="" src="/uploadfile/201301/2/B319597296.jpg" width="867" border="0" /> 本教程包含五个PHP文件中,三是PHPmailer文件其他SMTP配置文件。class.phpmailer.php // PHP Mailer library class.smtp.php class.pop3.php Send_Mail.php // SMTP configer index.php // Start Page Send_Mail.php在这里,你必须设置Amazom SES SMTP凭证。<?php function Send_Mail($to,$subject,$body) { require ''class.phpmailer.php''; $from = "from@email.com"; $mail = new PHPMailer(); $mail->IsSMTP(true); // SMTP $mail->SMTPAuth = true; // SMTP authentication $mail->Mailer = "smtp"; $mail->Host= "tls://email-smtp.us-east.amazonaws.com"; // Amazon SES $mail->Port = 465; // SMTP Port $mail->Username = "Amazon SMTP Username"; // SMTP Username $mail->Password = "Amazon SMTP Password"; // SMTP Password $mail->SetFrom($from, ''From Name''); $mail->AddReplyTo($from,''9lessons Labs''); $mail->Subject = $subject; $mail->MsgHTML($body); $address = $to; $mail->AddAddress($address, $to); if(!$mail->Send()) return false; else return true; } ?> index.php这里需要调用Send_Mail函数,并且传递主题值和邮件体的值。<?php require ''Send_Mail.php''; $to = "to@gmail.com"; $subject = "Test Mail Subject"; $body = "Hi<br/>Test Mail<br/>Amazon SES"; // HTML tags Send_Mail($to,$subject,$body); ?> GMail SMTP你必须修改上文中send_mail.php的代码,Gmail每天限制发送250封邮件。$mail->Host= "tls://smtp.gmail.com"; // GMail SMTP $mail->Port = 465; // SMTP Port $mail->Username = "Username@gmail.com"; // SMTP Username $mail->Password = "Gmail Password"; // SMTP Password 示例演示:http://labs.9lessons.info/原文链接:http://www.9lessons.info/2012/02/amazon-simple-email-service-smtp-using.html