This module was working beautifully until Friday when our email provider turned off TLS 1.0 support and now no email will send on any port with SSL or TLS. It was working on port 587 with TLS encryption. I can't see any other settings I can change, but the settings are the same as my email, so I am presuming it's the underlying code that is still trying to use TLS 1.0, rather than 1.1 or 1.2

Can this be checked and actioned if needed ASAP please? If I have got the wrong end of the stick, please forgive me.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Beckey created an issue. See original summary.

christine1126’s picture

I had same issue, it was working on port 587 with TLS encryption, our SMTP server is sendgrid, it stops working since last week.

christine1126’s picture

Sorry, my mail issue isn't caused by TLS, our system enabled the whitelist in sendgrid, so site mail stops work.

cosolom’s picture

Status: Active » Needs review
Related issues: +#2295773: D7.x: Update PHPMailer to v6.0

Try this patch https://www.drupal.org/project/smtp/issues/2295773#comment-12685360. There added some options for ssl connect. May help.

focal55’s picture

We experience trouble with this as well. We are using SparkPost and they sent out a notification about deprecating TLSv1.0 on July 9th although it just started effecting us today. During debugging we found a simple change in the smtp.transport.inc file can set up TLSv1.1 which Sparkpost supports. Attached is the simple patch.

bburg’s picture

@focal55, Also using Sparkpost and running into this issue, I'll give your patch a test.

fpignata’s picture

@focal55.. thank you.. the patch work here.

bburg’s picture

Hello,

Here is a patch compatible with the 8.x version of this module.

Edit: Re-queued test for 8.x.

bburg’s picture

Version: 7.x-1.7 » 8.x-1.x-dev

Status: Needs review » Needs work

The last submitted patch, 8: smtp-tlsv1_1-2983132-8.patch, failed testing. View results

bburg’s picture

This is odd, in some of my environments, STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT is an undefined constant. But it is defined in some environments. Where does this come from?

bburg’s picture

Now I'm getting this warning:

Message Warning: stream_socket_enable_crypto() expects parameter 3 to be long, string given in Drupal\smtp\PHPMailer\SMTP->StartTLS() (line 199 of /srv/bindings/706e44ccf02148479a543d125acb8a4d/code/web/modules/contrib/smtp/src/PHPMailer/SMTP.php) #0

I don't think it's causing any specific problems, but it probably should be dealt with.

Also, anyone using the patches in #5 or #8 will also need to be sure they are using at least PHP 5.6 as that constant was not introduced until that version (does the module specify this as a dependency?).

JoseCarlosss’s picture

#5 test in Sparkpost and works, thank you focal

zkrzyzanowski’s picture

I'm unable to apply the patch from #5 since we're on php 4.4.45, which doesn't have the constant STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT defined. I hardcoded the value for that, 17, and get a success message and the following error:
Notice: Undefined variable: rply in SMTP->Quit() (line 613 of /var/www/vhosts/github/alta.bcorporation.net/sites/all/modules/contrib/smtp/smtp.transport.inc).

Mail fails to send.

bburg’s picture

@zkrzyzanowski,

PHP 4.4 went end of life almost 10 years ago: http://php.net/eol.php. You should upgrade your PHP.

Steven Jones’s picture

The patch in #5 works nicely for me. However, as others point out, you do need PHP5.6+
Also would it make sense to enable TLS v2 too:

if (!stream_socket_enable_crypto($this->smtp_conn, TRUE, STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)) {
goron’s picture

Here's a patch for 7.x that uses the approach from the current version of PHPMailer to use the higher version constants if available but still default to the older one if needed (so as to not causes php warnings/errors on those environments).

Steven Jones’s picture

Patch in #17 works a treat!

goron’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 17: smtp-tlsv1_1-2983132-17.patch, failed testing. View results

Greg Varga’s picture

For everybody, who is getting the "StartTLS not supported by server or could not initiate session." error. (Sparkpost, dotMailer, etc)

Drupal 7
PHP: 5.6.7 and above inc. PHP 7.x
SMTP module: 7.x-1.7

How to fix?

- Find the smtp.transport.inc file in SMTP module.
- Go to line 200
- Update the following line so they look like this:

    // Begin encrypted connection
    if (!stream_socket_enable_crypto($this->smtp_conn, TRUE, STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)) {
      return FALSE;
    }

What happened?

- TLSv1.0 has been deprecated (https://www.sparkpost.com/docs/tech-resources/tlsv1-0-test-hostname)
but the current version of the SMTP module PHP Mailer implementation only uses TLSv1.0.

Now, be careful because since PHP 5.6.7, STREAM_CRYPTO_METHOD_TLS_CLIENT (same for _SERVER) no longer means any tls version but tls 1.0 only (for "backward compatibility"...).

Source: https://secure.php.net/manual/en/function.stream-socket-enable-crypto.ph...

Thank you @focal55 #5 & @steven-jones #16 for the ideas.

I hope this helps someone.

zkrzyzanowski’s picture

@bburg,
I had a typo on that one, we're on 5.4.45. Upgrading isn't an option for us at the moment, as we've got a pending site launch in the next few weeks and don't have time to test everything that might break as a result of the upgrade.

hassan.farooq121’s picture

Patch in #5 is not working form. My config:
PHP: 5.6.32
MySQL: 5.5

module version: 7.x-1.7

nubeli’s picture

@goron looks like you patch is for 7.x but was tested with 8.x.

goron’s picture

@nubeli you're right. I re-queued for 7.x.

goron’s picture

Status: Needs work » Needs review
Steven Jones’s picture

@hassan.farooq121 can you try the patch in #17.

Maintainers: the patch in #17 looks RTBC imho, but obviously this issue is still against version 8.x-1.x-dev so I'm not going to set it to RTBC.

wundo’s picture

wundo’s picture

wundo’s picture

Maintainer here, in case someone wants to test it, here is the PR in github for this issue: https://github.com/chuva-inc/drupal-smtp/pull/7

Status: Needs review » Needs work

The last submitted patch, 31: smtp-tlsv1_1-2983132-31.patch, failed testing. View results

wundo’s picture

Status: Needs work » Needs review

Fixed the tests in PHP 5.* re-testing.

nubeli’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #31 works.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 31: smtp-tlsv1_1-2983132-31.patch, failed testing. View results

J-Lee’s picture

The path from #31 couldn't apply to the latest dev.
This one should.

Status: Needs review » Needs work

The last submitted patch, 36: smtp-tlsv1_1-2983132-36.patch, failed testing. View results

J-Lee’s picture

My fault. Patch #31 apply but there is another issue. Sorry

J-Lee’s picture

Status: Needs work » Reviewed & tested by the community

Successfully applied patch # 31.
All tests are passed in my environment.

I put it back to RTBC.

wturrell’s picture

This patch worked on a previous site, but I'm now seeing the same problem I had before:

Symptoms: 'Send test e-mail' working via Postmarkapp as intended, real emails ignoring the smtp settings and just using default PHP mail)

This is on a new site that's running PHP 7.3.4-2 (Debian 10).

Here are the values of the constants reference in the patch, if it's of any debugging use:

STREAM_CRYPTO_METHOD_TLS_CLIENT = 9 on PHP 7.1.30 (smtp works), 57 on 7.3.4 (broken)
STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT = 33 on both.

I tried changing the port from 587 to 25 and turning TLS off, but that made no difference either.

Anyone else seen this yet?

wturrell’s picture

Apologies - I wrote that late last night, and of course this issue is absolutely nothing to do with my problem (was just coincidence).

This is actually the solution (a config change is needed, currently not well documented):
#3003639: Emails don't obey module settings (even though 'Test email' works) without configuring default system.mail interface

Sorry for posting in wrong place.

  • wundo committed 3d354b3 on 8.x-1.x
    Issue #2983132 by wundo, goron: Error since Mail Provider turned off TLS...

  • wundo committed b1c0512 on 7.x-1.x authored by goron
    Issue #2983132 by bburg, goron, focal55, Steven Jones, wundo: Error...
wundo’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

davej’s picture

Thanks for this fix! Would you consider putting out a 7.x release including the fix? Would be much appreciated, as TLS v1.0 is rightly disappearing.

yaach’s picture

I'm still having the similar issue.

In my case the SMTP server that I need to connect only accepts TLS1.0, and there is no way to tell them to upgrade or it will take longer.

The handshake is not working because I believe the client (Drupal site) has a higher protocol than the server.

How can I solve this?

JParkinson1991’s picture

Updated patch for use with 7.x-1.7. Noticed previous patch has already been applied to development branch so not included here.

Patch checks for all available STREAM_CRYPTO_METHOD_TLS_CLIENT constants and uses those that are found when initialising connections.

igorski’s picture

I can confirm that the patch in #48 works fine.