Hi together
I am facing an issue, when trying to send HTML mail using the mimemail module.
The problem i have is, that the Return-Path header is not set correctly in the outgoing Mail. that leads to problems with many mail providers.
I tracked the problem down to the function MimeMailFormatHelper::mimeMailHeaders where this function wraps the return-Path into <> brackets. This leads to a problem in PhpMail::mail() where $site_mail === $message['Return-Path'] is false then, since $message['Return-Path'] is wrapped. Also the wrapped address is not shellsafe, which results in sendmail using the default address, which is not correct in my case.
i will create a patch for that.
Comments
Comment #2
megadesk3000 commentedComment #3
imclean commentedThis is the correct format for the "Return-Path" header. See https://tools.ietf.org/html/rfc2822#section-3.6.7 :
That said, it's not really correct for Drupal to set the "Return-Path" header at all. The envelope sender is used by the delivering mail server to set "Return-Path". See: https://tools.ietf.org/html/rfc2821#section-4.4
However, this is how Drupal works at the moment so probably the subject of another discussion.
Comment #4
matthijsComment #5
mpp commentedBased on the RFC it would seem that mimemail handles this correctly.
This is a core bug in Drupal\Core\Mail\Plugin\Mail::mail the return path is set but it doesn't handle the path in an RFC compliant way (it doesn't take into account the angle brackets):
The reason the patch in #2 works is:
- mimemail with 3018562#2 removes the angle brackets
- core mail compares the email addresses and they match
In fact core should compare the addresses in a compliant way (with angle brackets)...
Comment #6
mpp commentedComment #7
imclean commentedBased on the RFC mimemail shouldn't be setting this at all.
See also: #3089331-6: Return-Path is set blank in MimeMailFormatHelper::mimeMailHeaders
Comment #8
l-laziz commentedThe patch from this issue RfcComplianceException: RFC 2822 applies cleanly to the latest 1.0-alpha5 version and removes <> from Return-Path.