I'm getting the following error when attempting to send a test email:

phpmailerException: SMTP Error: Could not connect to SMTP host. in PHPMailer->SmtpConnect() (line 845 of /drupal/sites/all/modules/contrib/smtp/smtp.phpmailer.inc).

I'm not sure if this is the issue I'm having or not, but when looking in smtp.phpmailer.inc I saw this in the header of the file:

 * PHPMailer - PHP email transport class
 * NOTE: Requires PHP version 5 or later

I'm running Drupal 7 on an older shared host server that's still using 5.3.29. I don't have any control over the PHP version here. I checked the installation instructions for the module in the README.txt file, but it didn't say anything about needing PHP 5. I'm pretty sure I've used the SMTP module on Drupal 7 sites before (and D6 too, maybe) that were on servers that were not on PHP5, so I'm hoping this is not relevant.

If that's the case maybe we should remove that NOTE because it's a little scary :)

Comments

jenlampton created an issue. See original summary.

D-XPERT’s picture

You are not alone, Did you figured this out ? Mine was working earlier but suddenly stopped working.
PHP version on server is 5.5 but still getting same error.
I am figuring this out. I will let you know if i find a solution.

Cheers!

DamienMcKenna’s picture

Status: Active » Closed (works as designed)

Drupal 7 requires PHP 5.2.4 or newer, this module doesn't add any additional requirements beyond that. The comment in smtp.phpmailer.inc is because it's a 3rd party library that was included, "PHP version 5 or later" covers everything you might have; fyi that was added because the library was written back in the days when many servers still used PHP 4.

saads90’s picture

I am getting same error as well but for me it work intermittently. Strange this is that all undelivered queued emails are delivered when cron is run. SMTP was running fine and suddenly it stopped working. There has been no change in server or php version.

Can anyone please help.

Thanks

sarikak’s picture

I also face same issue, drupal_mail() and SMTP test mail works fine, But the mails set during form submission is not working.

Error logs:

Type : smtp
Message : Error sending e-mail from noreply@test.demo to wetesters@yahoo.com : SMTP Error: Could not connect to SMTP host.

Type : smtp
Message : phpmailerException: SMTP Error: Could not connect to SMTP host. in PHPMailer->SmtpConnect() (line 845 of /..../sites/all/modules/contrib/smtp/smtp.phpmailer.inc).

Type : mail
Message : Error sending e-mail (from me@yahoo.com to wetesters@yahoo.com).

Can anyone please help.

Thanks

DamienMcKenna’s picture

@sarikak: Please open a new issue for that.

manishdrupaldev’s picture

Hi,

I have PHP Version: 7.0.15 and Drupal Version: 7.53 and SMTP Version: 7.x-1.6

I am trying to test email from SMTP configure setting page, it's working proper.
But when i am trying to change the site version in other language, suppose in Chinese Version, then i am getting error in error log.

phpmailerException: SMTP错误:无法连接到SMTP主机。 in PHPMailer->SmtpConnect() (line 810 of /var/www/sites/all/modules/smtp/smtp.phpmailer.inc)

Can anyone please help.

Thanks,