Problem
The return address in the MAIL command SHOULD, if possible, be
derived from the system's identity for the submitting (local)
user, and the "From:" header field otherwise. If there is a
system identity available, it SHOULD also be copied to the Sender
header field if it is different from the address in the From
header field. (Any Sender header field that was already there
SHOULD be removed.) Systems may provide a way for submitters to
override the envelope return address, but may want to restrict
its use to privileged users. This will not prevent mail forgery,
but may lessen its incidence; see Section 7.1.
This probably means when overriding the envelope sender in the module's settings it should also override the Sender: header.
Proposed Resolution
Look into it further and make any required changes.
Comments
Comment #2
imclean commentedThis is causing problems as the
Senderheader can contain a name and address whereas the envelope sender is just an address in angle brackets. PHPMailer uses theSenderproperty to set the envelope sender.Comment #3
imclean commentedPHPMailer discussion here: https://github.com/PHPMailer/PHPMailer/issues/1250
Comment #4
imclean commentedIt looks like Drupal may be setting the
Senderheader incorrectly. https://tools.ietf.org/html/rfc5322#section-3.6.2Comment #6
imclean commentedTidied up sender, envelope sender and from handling.
Changes:
$message['headers']['From']$message['from']Senderheader if presentReturn-Pathheader if present