Expected response code 250 but got code "", with message "" When sending emails with Amazon SES and Swiftmailer

830 views Asked by At

Sending emails that way used to work fine but the other day, in the mail of a script sending a lot of emails, I started getting this error for every email sent:

"Expected response code 250 but got code "", with message """

I cannot find any help on the Amazon SES website.

1

There are 1 answers

0
errogaht On

in my case it was because of email processing handled by queue worker, and it looks like transport is open until worker process end, so Swiftmailer send many emails in long-running connection and at some point SMTP server closes connection on timeout. this code helps if used before $this->mailer->send()

if ($this->mailer->getTransport()->isStarted()) {
    $this->mailer->getTransport()->stop();
}