Skip to content

Commit

Permalink
Don't block when SMTP server quits.
Browse files Browse the repository at this point in the history
Port changes from #10227 to 3.x
  • Loading branch information
markstory committed Feb 16, 2017
1 parent 2411728 commit 988dd17
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 158 deletions.
6 changes: 5 additions & 1 deletion src/Mailer/Transport/SmtpTransport.php
Expand Up @@ -433,7 +433,11 @@ protected function _smtpSend($data, $checkCode = '250')
$response = '';
$startTime = time();
while (substr($response, -2) !== "\r\n" && ((time() - $startTime) < $timeout)) {
$response .= $this->_socket->read();
$bytes = $this->_socket->read();
if ($bytes === false || $bytes === null) {
break;
}
$response .= $bytes;
}
if (substr($response, -2) !== "\r\n") {
throw new SocketException('SMTP timeout.');
Expand Down

0 comments on commit 988dd17

Please sign in to comment.