Input sent without waiting for greeting
A full-featured email creation and transfer class for PHP
Brought to you by:
coolbru
We noticed that PHPMailer may not be waiting long enough to be greeted by an SMTP server before continuing to send data.
Putting
sleep(10);
in the class.smtp.php file, immediately before
if(empty($this->smtp_conn))
solved this issue.
Perhaps PHPMailer should be waiting to be greeted by the SMTP server?
The errors we saw were these:
SMTP protocol synchronization error (input sent without waiting for greeting)
This is in the
Connect
function. It's quite common for servers to impose a long (but usually varying randomly) greetdelay as an anti-spam measure, or just because they are slow. The connection already specifies a timeout for the connection (defaults to 30 sec) but the delay after connection but before greeting could be up to a couple of minutes. Adding a fixed sleep like this will penalise all connections, including those that may not need it, and it may not be enough to cope with servers actively using greetdelay. It certainly should wait to be greeted before continuing, but it should wait for the greeting, not for a random amount of time.Closing in favour of https://github.com/PHPMailer/PHPMailer/issues/104