SMTPMailSystem may fail to send emails due to incorrect email extraction from headers

Created on 6 March 2025, about 1 month ago

Problem/Motivation

The SMTPMailSystem plugin incorrectly extracts email addresses from the "From" and "Return-Path" headers when they are formatted as (without a display name). The preg_match() regex requires a mandatory space before the email, which leads to extraction failures.

Steps to reproduce

- Configure SMTPMailSystem to send an email where the From address is in the format (without a display name).
- Attempt to send an email.
- Observe that PHPMailer may fail to process the email, or it may be rejected by some mail servers.

Proposed resolution

- Modify the regex in SMTPMailSystem.php to correctly extract the email address when there is no display name.
- Ensure that the Return-Path header also correctly extracts just the email.
- Apply trim() to prevent issues with leading/trailing spaces.

🐛 Bug report
Status

Active

Version

1.4

Component

Code

Created by

🇬🇧United Kingdom lukus

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024