SMTP connection has timed out

SMTP connection has timed out issue has started causing problems with our newly version upgraded project. For our case, it was originally just silently falling back to Sendgrid so our testers team did not manage to pick out.

These are the different errors have you might have been seeing.

smtp.mailgun.org has timed out
smtp.eu.mailgun.org has timed out
r3-smtp.dotdigital.com has timed out

These errors are caused by an update from Laminas 2.14.1 to 2.14.2 (and possibly some 2.15.x) versions. Laminas has provided a fix at 2.14.3 and the latest version of 2.15.x to patch this issue, and more information can be read from some of the Github ticket here #167, #168 and #170.

 

Problems?

1. Checkout issues causing duplicated order

Due to the timeout, emails got caught into exception error which caused the customer to pay for it repeatedly. Repeated payment has resulted into “duplicated” orders as customer will not notice that card has been charged due to the error notice.

2. GA issues

Due to exception error, customer will not get redirected to Success Page, which has resulted into all Enhanced Ecommerce not being tracked. GA will have 0 conversion due to this loading error which will never bring customer to the success page.

 

Solutions?

1. Upgrade Laminas Mail to the latest version (if you’re able to)

Laminas has already provided at update from 2.14.2 onwards, and the latest version of 2.15.x.

2. Use .patch file to patch directly (if you are wary due to your project Production status)

As per comment in #168, patch line 293 of Laminas Mail’s Abstract Protocol file.

laminas/laminas-mail/src/Protocol/AbstractProtocol.php

       if (isset($info['timed_out']) && $info['timed_out']) {

For those in Magento Commerce Cloud, you can easily drop the patch file into /m2-hotfixes/ folder, and Cloud will automatically patch it during their CI/CD deployment.

Patch File: laminas-mail-2-14-1.patch

 

Do share below if you have encountered more issues with the recent upgrades! Read more on Session size exceeded allowed session max size – Magento 2 which looks to have caused quite a bit of issues given the amount of views I have seen on the post!