我遇到了PHPmailer(版本5.1)的一个奇怪问题,我正在尝试解决这个问题.我在这里看到了很多好的反馈,所以我想我会尝试一下.我发现当我尝试使用基于条件语句创建自定义确认消息时$mail->send(),我会收到重复的电子邮件.我可以使用phpmailer下载附带的通用testemail.php脚本复制它.这是代码:
require '../class.phpmailer.php';
try {
$mail = new PHPMailer(true); //New instance, with exceptions enabled
$mail->SMTPDebug = 1;
$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 25; // set the SMTP server port
$mail->Host = "mail.domain.com"; // SMTP server
$mail->Username = "username"; // SMTP server username
$mail->Password = "password"; // SMTP server password
$mail->IsSendmail();
$mail->From = "example_from@domain.com";
$mail->FromName = "First Last";
$to …Run Code Online (Sandbox Code Playgroud)