简体   繁体   中英

MailTrap not working on Laravel with homestead

I used to use MailTrap with Laravel just fine.

However, since I updated to Laravel 5.6 and updated to Homestead, I can't seem to send any mail using MailTrap.

Here is a snippet of how my .env file looks similar to:

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=XXX
MAIL_PASSWORD=XXX
MAIL_ENCRYPTION=null
MAIL_FROM_NAME="John Smith"
MAIL_FROM_ADDRESS=admin@foo.com

I have also cleared my config cache and re-cached it, as well as restarted the server.

Whenever, I try sending mail I get a Swift_TransportException with the message: Connection could not be established with host mailtrap.io [Connection timed out #110] .

Why is this happening and how can I fix this issue.

You need to change MAIL_HOST=mailtrap.io to MAIL_HOST=smtp.mailtrap.io because mailtrap.io is a deprecated url.

You can read more there .

On 8 March 2018 Mailtrap blocked the traffic from “mailtrap.io”.

The Mailtrap users who signed up for Mailtrap before November 10th, 2016 and did not update their credentials have to make a slight change in the SMTP host address: add “smtp” to the current SMTP host name . So, instead of “mailtrap.io”, it will be called “smtp.mailtrap.io”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM