当本地主机上使用的PHPMailer(Windows的XAMPP),电子邮件发送确定,但剧本永远挂起 - 没有刷新。的PHPMailer发送电子邮件,然后挂起(在Windows,XAMPP)
PHP自己的mail()函数工作正常,而PHPMailer的工作正常使用sendmail,所以这只是SMTP模式的问题。
奇怪的是,与Xdebug的步进通过时,
I get "Fatal error: Maximum execution time of 0 seconds exceeded" in the console when I reach __destruct()
虽然我可以一步通过这一点,这让我刷新并在浏览器中反映的错误。而且,一旦我这样做了,我可以刷新浏览器,并且新电子邮件将正常发送,没有错误,也不会挂起。退出调试模式并返回挂起行为。
注:在php.ini: max_execution_time=60
max_input_time=60
require_once "PHPMailerAutoload.php";
$to = "[email protected]";
$to_name = "Me";
$from_name = "fromName";
$from = "[email protected]";
$subject = "This is a test email from php " . strftime("%T", time());
$message = "phpmailer using smtp";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Host = "# censored #";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Hostname = "myhost";
$mail->Username = '# censored #';
$mail->Password = '# censored #!';
$mail->FromName = $from_name;
$mail->From = $from;
$mail->addAddress($to, $to_name);
$mail->Subject = $subject;
$mail->Body = $message;
$result = $mail->send();
echo $result ? 'Sent' : 'Error: ' . $mail->ErrorInfo;
我试过要求你说的类,没有运气。电子邮件总是立即发送,但脚本之后挂起,与之前一样。此外,单步执行代码时,我发现您发布的代码段被跳过,因为它应该在Windows机器上。 – brotherhutch