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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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

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.

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