Problem/Motivation

This module supplies a "Turn on the SMTP keep alive feature" feature but it does not seem as though there's a realistic scenario where the connection would be re-used. This is because the SMTP mailer object that contains the connection gets recreated any time mail is sent.

Steps to reproduce

1. Install the SMTP module and configure it appropriately.
2. Turn on your debugger and set a break point at the start of the smtpConnect() method in PHPMailer\PHPMailer\PHPMailer.
3. Make a request that will trigger multiple e-mails (I don't know off the top of my head of anything in core that would do this unfortunately).
4. Step through this function. You'll see that the (null === $this->smtp) check passes and the ($this->smtp->connected()) check fails, forcing reconnection.

Proposed resolution

Store the mailer object in the service if keep alive is enabled. I'll attach an MR for this shortly.

Issue fork smtp-3214643

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Dylan Donkersgoed created an issue. See original summary.

dylan donkersgoed’s picture

Status: Active » Needs review
japerry’s picture

Status: Needs review » Fixed

Good find, and solution. Fixed.

Status: Fixed » Closed (fixed)

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