Вопрос

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