Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

geertjanknapen1's avatar

Expected response code 250 but got empty code.

We keep running into the below error.

dev.ERROR: Exception occurred when sending an email {"exception":"[object] (Symfony\Component\Mailer\Exception\TransportException(code: 0): Expected response code \"250\" but got empty code. at /usr/share/nginx/html/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php:338) ","message":"Expected response code \"250\" but got empty code."

It's sporadic and does not happen all the time. It happens for all types of addresses (not only Gmail). We are sending emails using Mandrill, with the below configuration. I added the MAIL_EHLO_DOMAIN as an attempted fix (that's what the internet told me). But that does not fix the problem.

I'm also not able to find anything online regarding this exact error, other people always get a different code instead of an empty one. (Like 550).

Configuration:

config/mail.php:

'smtp' => [
     'transport' => 'smtp',
     'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
     'port' => env('MAIL_PORT', 587),
     'encryption' => env('MAIL_ENCRYPTION', 'tls'),
     'username' => env('MAIL_USERNAME'),
     'password' => env('MAIL_PASSWORD'),
     'timeout' => null,
],

.env file:

MAIL_MAILER=smtp
MAIL_HOST=smtp.mandrillapp.com
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_USERNAME=<OUR_USERNAME>
MAIL_PASSWORD=<OUR_PASSWORD>
MAIL_FROM_ADDRESS=<OUR_MAILBOX>
MAIL_FROM_NAME=<OUR_FROM_NAME>
MAIL_EHLO_DOMAIN=<OUR_DOMAIN>
MANDRILL_SECRET_KEY=****************

Any pointers in the right direction would be greatly appreciated!

0 likes
4 replies
enoch91's avatar

@geertjanknapen1 this is related to the SMTP communication between your app and Mandrill.

  • Check that Mandrill's servers are operational and not experiencing any downtime or issues.
  • Double-check your SMTP configuration settings to ensure they are accurate with the values in your .env file.
  • Contact Mandrill Support
geertjanknapen1's avatar

@enoch91 Yes, I thought about that, the configuration seems fine. The error also seemingly happens at random, sometimes the mail goes through and sometimes this error is thrown.

Do you have an example configuration or something along the lines?

enoch91's avatar
enoch91
Best Answer
Level 2

@geertjanknapen1 If this happens at random, then it's most likely that Mandrill's servers are experiencing any downtime or issues. I suggest you contact Mandrill support or change provider.

Check the logs on Mandrill's dashboard to see if there are any additional error messages or clues about what might be causing the issue.

Furthermore, if you have instances of the mail going through with the same configuration, it means that your configuration is okay.

geertjanknapen1's avatar

@enoch91 Well the thing is, there are no log entries for failed email. Changing provider is not an option at the moment and the servers Mandrill does not seem to be down since some mail goes through and StatusGator shows its up.

I'll try contacting Mailchimps support, however they've proved more than once to not be all too helpful.

Thanks for the answers though.

1 like

Please or to participate in this conversation.