Question

Error sending e-mail from admin@*** to ***@gmail.com: SMTP Error: Could not connect to SMTP host.

I am getting bellow error while trying to send mail from drupal 9 SMTP mail. Please guide.

Error sending e-mail from admin@* to *@gmail.com: SMTP Error: Could not connect to SMTP host.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
July 3, 2022

Hello there,

As already mentioned this error might be related to the settings you’re using. Google’s SMTP server does not use port 25 and so you’ll need to set either port 465 or 587.

We have an article on How To Use Google’s SMTP Server which you can check here:

https://www.digitalocean.com/community/tutorials/how-to-use-google-s-smtp-server

Regards

KFSys
Site Moderator
Site Moderator badge
June 29, 2022

Hi @driftingaquashark,

This does sound like your port is being blocked. What port are you using, is it 25 or 465/587? If you are using port 25 it’s most probably being blocked. Firstly, I’ll recommend using port 465/587 but if you must use port 25 I’ll recommend contacting the DigitalOcean’s support who will be more than happy to assist you with your account issue! :)

https://www.digitalocean.com/support/

Hope that helps! - KFSys.

Bobby Iliev
Site Moderator
Site Moderator badge
June 29, 2022

Hi there,

Port 25, might be closed for some new accounts. What I would suggest instead is using port 587 or 465 rather than port 25.

Let me know how it goes!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up