當本地主機上使用的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