Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

m.zedoo's avatar

Send email on shared hosting

I got this error : Swift_TransportException in StreamBuffer.php line 265: Connection could not be established with host smtp.sendgrid.net [Connection refused #111]

When trying to send email on real server ( godaddy shared hosting ), but with the same configurations on localhost this is running. And I really don't know why ?!!!

'MAIL_ENCRYPTION'=>'tls', 'MAIL_DRIVER'=>'smtp', 'MAIL_HOST'=>'smtp.sendgrid.net', 'MAIL_PORT'=>'587', 'MAIL_USERNAME'=>'xxxxxxxxx', 'MAIL_PASSWORD'=>'xxxxxxxxx',

or

'MAIL_ENCRYPTION'=>'ssl', 'MAIL_DRIVER'=>'smtp', 'MAIL_HOST'=>'smtp.sendgrid.net', 'MAIL_PORT'=>'465', 'MAIL_USERNAME'=>'xxxxxxxxx', 'MAIL_PASSWORD'=>'xxxxxxxxx',

0 likes
4 replies
willvincent's avatar
Level 54

From another site...

GoDaddy does not let you send emails via external SMTP on a shared hosting plan.

Here's GoDaddy's own words:

We appreciate your feedback and apologize for any inconvenience, however, due to security reasons, we are not able to allow the use of external SMTP servers in a shared hosting environment. If you need additional SMTP relays, you would need to consider a virtual dedicated or dedicated server.

So.. I guess the short answer is, you need a better host.

thomaskim's avatar

Try using the mail driver rather than SMTP.

3 likes
t0berius's avatar

I would suggest you to use mandrill, it' simple, fast and easy to use.

Please or to participate in this conversation.