Expected response code 250 but got code "550" Laravel swift mailer

  email, laravel, php, phpmailer, swiftmailer

I can send email from tinker but when I try to send email from code in laravel framework I get below error:

Swift_TransportException (550)
Expected response code 250 but got code "550", with message "550 Bad HELO - Host impersonating domain name [mydomain.com] "

This is my simple mail method to test sending email from laravel controller :

  Mail::send('errors.401', [], function ($message) { $message->to('[email protected]')->subject('this works!'); });

.env file:

MAIL_DRIVER=smtp
MAIL_HOST=mail.mydomain.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=<password>
MAIL_ENCRYPTION=

I’ve done below steps but still it doesn’t work:

composer dump-autoload
php artisan view:clear
php artisan cache:clear
php artisan config:cache

Any idea how to solve this?

Source: Laravel

Leave a Reply