Error sending email MSMTP error: "-f" (Return-Path) has wrong format

Created on 17 December 2024, 4 months ago

Problem/Motivation

The module doesn't work with MSMTP sender, which is set up as default mailer in wodby/drupal-php.

"MimeMail" module class extends "PhpMail" core class, debugging params they send to mail() I found difference:

# PhpMail
"admin@example.com"
# MimeMail
"<admin@example.com>"

Removing lt and gt chars solves the issue.

Proposed resolution

Don't include lt and gt chars in "Return-Path" header.

History

In D7 branch there was an issue "Trim less-than and grater-than chars from Return-Path", which fixes it.

But in D8 initial version this header was commited with the chars. Git link.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ΎBelarus dewalt

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

Comments & Activities

  • Issue created by @dewalt
  • πŸ‡§πŸ‡ΎBelarus dewalt

    The patch

  • πŸ‡§πŸ‡ΎBelarus dewalt
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    The < and > are *required* by the RFC. Any mailer that does not accept them is broken.

    That said, there is currently a bug in Drupal core that affects Mime Mail return path header. See πŸ› RfcComplianceException: RFC 2822 Needs work

    In short, Drupal core now automatically adds the < and > to the return path header, and rejects the valid header that Mime Mail sets because the Mime Mail header has already added these characters. See that issue for workarounds and maybe help out in that issue too?

Production build 0.71.5 2024