I have installed this module and I get below error when an email is being sent from my website.

SMTP -> ERROR: Failed to connect to server: Connection timed out (110) 
SMTP Error: Could not connect to SMTP host.

Please help me to fix this issue.

Thanks,
AnAnD

Comments

takesomelight’s picture

Hello, I have the same problem. Please let me know if someone find a solution. Thank you. TSL

ron_ron’s picture

Hello,

same problem.

Thank you for a solution.
ron

ron_ron’s picture

Status: Active » Needs review

Hello,

found the solution. Error is in the smtp.phpmailer.inc in line 835.

change the line 843 - 836 with this code

if (!$connection) {
          //throw new phpmailerException(t('SMTP Error: Could not connect to SMTP host.'));
          $this->smtp->Reset();
        }

Ron

silurius’s picture

#3 didn't work for me.

SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
The following From address failed: myemail@mydomain.com
kenorb’s picture

Version: 7.x-1.0-beta1 » 7.x-1.0
Category: support » bug
Priority: Normal » Major
Status: Needs review » Active

I've this error on my homepage.

SMTP Error: Could not connect to SMTP host.
kenorb’s picture

Issue summary: View changes

content update

makokis’s picture

Issue summary: View changes

same issue here

wundo’s picture

Status: Active » Fixed

Please confirm your PHP server has access to the SMTP server you're trying to connect.

makokis’s picture

I'm using google acount and smtp setting are well set

Primary SMTP server: smtp.google.com
SMTP port: 465
Use secure protocol: SSL
User & pass: myuser & mypass

thanks for help

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

artem_antonov’s picture

This happened to me when the SMTP server has the whitespace character before the address (" smtp.gmail.com")

kenorb’s picture

Status: Closed (fixed) » Closed (works as designed)
cthshabel’s picture

artem_antonov

THANK YOU VERY MUCH FOR SHARING YOUR FIX

for me, it was something as basic as the white space before address (" smtp.gmail.com") too

module maintaner... is it necessary to have this space at the beginning? Can it be removed?

Thanks so much SMTP team. It is an incredible module that should absolutely be in core.

vishal.sirsodiya’s picture

Hi makokis,
#8

As per your suggestion, I have configured SMTP module. But I have facing new problem.
Please see below error :-
SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
SMTP Error: Could not connect to SMTP host.

Thank

barywhyte’s picture

I got similar error to after uploading the site to internet. On the localhost, before uploading SMTP authentication module worked flaulessly.

SMTP -> ERROR: Failed to connect to server: (0)
Error message Unable to send e-mail. Contact the site administrator if the problem persists.

My host has provided some solutions which has not worked for me. Any workable solutions will be much appreciated. This is my first site with drupal www.barywhyte.com.ng

kenorb’s picture

barywhyte’s picture

@kenorb Thanks. Problem solved with the help of my host. SMTP settings has to change when you migrate from localhost to internet

AlexBorsody’s picture

whatespace after smtp address

ariel_fidenco’s picture

Thanks to #10, I can't believe I didn't notice that trailing blank space for almost an hour. THANKS!

mattbk’s picture

Thank you AlexBorsody, #17.