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

dulithamahishka's avatar

Symfony\Component\Mailer\Exception\TransportException: Expected response code "250" but got empty code.

I have updated my Laravel 8 application to Laravel 9 with PHP 8.1. But when I run queue:work the response returns with the error with the email sending. The error says,

Symfony\Component\Mailer\Exception\TransportException: Expected response code "250" but got empty code.

What did I do wrong? With Laravel 8 I did not encounter these issues, it has happened right after I updated it to Laravel 9.

The error returns from /vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php in Symfony\Component\Mailer\Transport\Smtp\SmtpTransport::assertResponseCode at line 337

if (!$valid || !$response) {
        $codeStr = $code ? sprintf('code "%s"', $code) : 'empty code';
        $responseStr = $response ? sprintf(', with message "%s"', trim($response)) : '';
       
        throw new TransportException(sprintf('Expected response code "%s" but got ', implode('/', $codes)).$codeStr.$responseStr.'.', $code ?: 0);
 }
0 likes
6 replies
Snapey's avatar

have you cleared config since the upgrade?

dulithamahishka's avatar

@Jobscan Engineering Unfortunately no! Could not find an answer yet. Please reply to this thread if you found an answer

Please or to participate in this conversation.