phpmailer timeout not working

送分小仙女□ 提交于 2019-12-06 16:39:32

The documentation states that "var $Timeout = 10 Sets the SMTP server timeout in seconds" and "this function will not work with the win32 version."

If you want a longer timeout value, simply set it to a minute (60 seconds) or so. If you are sending multiple emails through the same SMTP server, it may be beneficial to keep the connection open, but then remember to close it at the end.

If you do extend the timeout, also make sure that you increase the time limit on the script, or remove it all together:

<?php
    set_time_limit(0); // remove a time limit if not in safe mode
    // OR
    set_time_limit(120); // set the time limit to 120 seconds

    $mail                = new PHPMailer();
    $mail->IsSMTP();
    $mail->Timeout       =   60; // set the timeout (seconds)
    $mail->SMTPKeepAlive = true; // don't close the connection between messages
    // ...
    // Send email(s)
    $mail->SmtpClose(); // close the connection since it was left open.
?>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!