Expected response code 354 but got code "503" Expected response code 354 but got code "503" laravel laravel

Expected response code 354 but got code "503"


I solved this by replacing Global "From" Address in mail.php file to the same input at .env for MAIL_USERNAME= .


From the error message, you're probably sending email through Gmail's SMTP service.

Your .env should look like this:

MAIL_DRIVER=smtpMAIL_HOST=mail.mydomain.comMAIL_PORT=587MAIL_USERNAME=support@mydomain.comMAIL_PASSWORD=mypasswordMAIL_ENCRYPTION=tls

Also you need to make sure:

  1. Your domain mydomain.com is properly setup to use GSuite's Gmail. You cannot setup Gmail's SMTP to send email of domains that are not in GSuite nor is a Gmail account.

  2. If your account has 2-step-verificaton enabled, you'd need an App Password for SMTP login.


For me, the solution was this:

After correctly setting up your SMTP or mail driver of choice. Sending a mail with a "mail-from" different from your hostname e.g "no-reply@differenthost.com" and your hostname is yourhost.com The mail will always go through, however, sending a mail with a "mail-from" as such: "no-reply@yourhost.com" which is possibly different from your .env mail authentication i.e "MAIL_USERNAME" : This will throw an error if that mail account hasn't been set up on your hosted server or c-panel.

My .env file had:

MAIL_FROM_ADDRESS=foo@bar.com

But my code had:

public function build(){    return      $this        ->from('myaddress@sometherdomain.com')        ->view('emails.clientNotification');}

This fixed it:

public function build(){    return      $this        ->from(env('MAIL_FROM_ADDRESS'))        ->view('emails.clientNotification');}