Reputation: 109
Hi I'm making a web application and need to send some e-mails. I'm using Laravel 5.6, and make the e-mail feature at localhost using Mailtrap to test it, worked fine. But when I put it on the server I got a weird error, like in the picture bellow.
I've configured the system to my host, Hostinger settings.
This is the config code in the .env file
MAIL_DRIVER=smtp
MAIL_HOST=mx1.hostinger.com.br
MAIL_PORT=587
MAIL_USERNAME=E_MAIL_HERE
MAIL_PASSWORD=PASSWORD_HERE
MAIL_ENCRYPTION=null
Upvotes: 7
Views: 9891
Reputation: 1
$message->from('[email protected]')
on your controller or anywhere defined, either remove it and just add the MAIL_FROM_ADDRESS="[email protected]"
to your .env
.$message->from('[email protected]')
anywhere you defined it, like in your controller for example.I believe this happens when you are trying to put another from email address which is not part of your server or domain. Use the email you create on your server or Cpanel.
Upvotes: 0
Reputation: 1491
I have faced the same issue.
Basically, I changed config/mail.php
variable MAIL_FROM_ADDRESS
to my actual email and it worked.
Upvotes: 7
Reputation: 1636
Code 354 is actually what Laravel expects, is not an error code. This is the SMTP server telling Laravel to proceed and send the body of the email. Note that this is what is expected, and not what you received.
Code 554 from a mail server indicates: "Transaction Failed", and you'll note that this is what you actually got.
The reason this is failing is indicated further in the message: Error: no valid recipients.
Without further data I can't tell why the recipient isn't set properly on your production server.
A more complete list of codes can be found here: https://www.greenend.org.uk/rjk/tech/smtpreplies.html
Upvotes: 5