John Davidson

php - Symfony\Component\Mailer\Exception\TransportException with message 'Expected response code "250" but got an empty response.'

0 comments
Message:


I'm using Google Workspace SMTP relay service to send emails from my Laravel app. It has been working well for over more than a year now, but I'm not sure what exactly stopped it from working.
When I try to send an email I get the following error:


>>> Illuminate\Support\Facades\Mail::to('[email protected]')->send(new App\Mail\CourseEnrolmentEmail($user, App\Course::first()));

// The error
Symfony\Component\Mailer\Exception\TransportException with message 'Expected response code "250" but got an empty response.'


I suspect it is related to my upgrade from Laravel 8 to Laravel 9, but not sure how to fix it.


My 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,
],


My mail config


MAIL_DRIVER=smtp
MAIL_HOST=smtp-relay.gmail.com
MAIL_PORT=587
MAIL_ENCRYPTION=TLS
MAIL_FROM_NAME="My Name"
[email protected]

I'm authenticating via IP, so the password and username fields are not required


My GSuite Gmail routing configuration




Note
In the above config, I have tried checking TLS and also changing Allowed senders to "Only Registered Apps users in my domains" but the problem still persists.


I have tried suggestions from



  1. https://laracasts.com/discuss/channels/laravel/laravel-swift-mailer-exception-expected-response-code-250-but-got-an-empty-response-using-gmail-smtp-relay-database-queue-driver



  2. Laravel 9 - Infomaniak : Expected response code "250" but got code "550", with message "550 5.7.1 Sender mismatch"



  3. https://stackoverflow.com/a/43283422/11752623



  4. https://www.cubebackup.com/blog/how-to-use-google-smtp-service-to-send-emails-for-free/ Method 3




All of them were not successful. I appreciated your help in solving this issue.



My Answer:
"Failed to send email: Connection refused"

Rate this post

5 of 5 based on 4231 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us