1

I have a laravel application that has been sending emails for Years now. Recently, emails have been failing to send. When I check the failed_jobs table, below is the error message:

Swift_TransportException: Expected response code 250 but got code "", with message "" in 
/apps/www/ccc.xxxx.com/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:383

Below are things I have attempted:

  • composer dump-autoload
  • php artisan config:cache
  • php artisan config:clear
  • php artisan queue:restart
  • restarted supervisor
  • Ensure username and password is correct in .env file
  • I have connected to the mail box successfully and able to send email to anyone

Below is the .env config

MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=g.blah@balh.com
MAIL_PASSWORD=Va#@2016
MAIL_ENCRYPTION=TLS

What can be the issue and how to fix this ?

Fokwa Best
  • 3,322
  • 6
  • 36
  • 51
  • Although you have mentioned that username and password are correct, I am not sure if it is. Also, could you change `MAIL_ENCRYPTION` to `STARTTLS` and wrap password to double quote. `MAIL_PASSWORD="Va#@2016"` and `MAIL_ENCRYPTION=STARTTLS` – Saroj Shrestha May 09 '22 at 13:05
  • read [this](https://stackoverflow.com/questions/70105920/package-swiftmailer-swiftmailer-is-abandoned-you-should-avoid-using-it-use-sym#:~:text=Abandoned%20does%20not%20mean%20bad,the%20mail%20package%20for%20years.) comment – boolfalse May 09 '22 at 13:23
  • Hi @SarojShrestha, I have done as commented but no success. I have also checked that port 587 is open and it is open – Fokwa Best May 09 '22 at 15:18

1 Answers1

0

Laravel Swiftmailer abandoned but it's still working fine with PHP 7 versions, maybe your PHP has been upgraded by someone or server administrator. Please check your PHP version and look at this file in your Swiftmailer vendor and change it if necessary.

Replace 127.0.0.1 to gethostname() in lib/dependency_maps/transport_deps.php

EHF Shahab
  • 700
  • 4
  • 14