문제

In my local environment on a mamp server I was successfully able to send mails using larvel. However, after moving to production server on Hostgator, I am unable to send mails. I keep getting the following exception:

Swift_TransportException
Connection could not be established with host smtp.gmail.com [Connection refused #111]

I am using my gmail credentials with smtp host as smtp.gmail.com and port as 587.

Update 1: I spoke to Hostgator (based on first comment) and they say that the port is already enabled, however, I still have the same problem.

Can anyone please throw some light as to what can be wrong here?

Thanks.

도움이 되었습니까?

해결책

If they were blocking the port you'd probably get a timeout. "Connection Refused" would be coming from Gmail's end. They may have blocked the Hostgator IP range, specially if it's a shared IP.

Try using Hostgator's own SMTP servers? They're a cPanel host, if I recall, so you should be able to just use localhost to send mail.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top