本文共 1110 字,大约阅读时间需要 3 分钟。
出错显示
exception 'phpmailerException' with message 'The following From address failed: support@phpxz.com' in /home/www/thinkphp/Vendor/PHPMailer/PHPMailer.class.php:710 Stack trace: #0 /home/www/thinkphp/Vendor/PHPMailer/PHPMailer.class.php(576): PHPMailer->SmtpSend('Date: Sat, 29 S...', '--b1_6eca3e61d8...') #1 /home/www/gameweb/Lib/Action/TestAction.class.php(102): PHPMailer->Send() #2 /home/www/thinkphp/Lib/Think/Core/App.class.php(305): TestAction->testmail2() #3 /home/www/thinkphp/Lib/Think/Core/App.class.php(329): App::exec(Array) #4 /home/www/default.php(36): App::run() #5 {main}
thinkphp结合phpmail来发送邮件,昨天QA测试发现不能发送邮件了,只更改了SMTP部分代码,之前的SMTP是可以发送的,使用phpmail测试代码设置新的SMTP也能正常发送,对比代码发现,是因为phpmail的$mail->From不一致导致的问题
$mail->Username = "service01@phpxz.com";
$mail->AddReplyTo("support@phpxz.com","name");
$mail->From = "support@phpxz.com";
$mail->FromName = "support@phpxz.com";
$mail->Username = "service01@phpxz.com";
$mail->AddReplyTo("support@phpxz.com","name");
$mail->From = "service01@phpxz.com";
$mail->FromName = "support@phpxz.com";
转载地址:http://yuctx.baihongyu.com/