简体   繁体   中英

Swift_TransportException in laravel

I'm running Laravel 5.5 and when i try to send email i got Swift_TransportException Expected response code 250 but got code "", with message "" .

I'm on localhost and i use Mailtrap to catch outgoing emails it was working perfect with the same settings but after a while i got that exception.

what weird is when i change my IP using a vpn it works and when i disable it it won't

i contact their support and asked if my IP is banned and they say no

So anyone can help me out i'm really confused Thank you in advance.

PS (I've already read most of similar topics here but none of them has same problem)

Laravel 5.5 using SwiftMailer 6.0 and this is the reason why mail transport isn't working. Swift_Transport_MailTransport(which you are trying to use) was removed from Swift Mailer 6.0 that's why you need to use SMTP transport instead.

This has started happening after upgrading to 5.5 to anyone who was using localhost with Mailtrap, Mailhog, etc. It worked for me once I got explicit with the local IP and switched to smtp:

MAIL_DRIVER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Edit:

I assumed you were using a localhost mail service, since you are actually using Mailtrap externally I'm not sure anymore, but I was receiving the exact same error on localhost until switching the IP and transfer protocol.

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