Opened 5 years ago

Closed 5 years ago

#17444 closed Bug (fixed)

Allow different MAIL TO and `To` headers

Reported by: Ethan Jucovy Owned by: nobody
Component: Core (Mail) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently the EmailMessage.message method sets the email's To: header to match the to argument to the message object's constructor.

It can be useful to set a To: header that is different from the actual recipients of the message. For example, when implementing a mailing list, the To: header can be set to the mailing list's address itself.

Currently, however, if you pass a custom To header in the constructor's headers argument, the resulting message contains two To headers.

I've provided a patch with tests that will instead look for a custom To header in extra_headers when constructing the mail message, defaulting to the present behavior if no custom To header was provided. This is analogous to the approach taken for the From header, which was implemented in #9214.

Attachments (2)

set_mail_to_header.diff (2.4 KB) - added by Ethan Jucovy 5 years ago.
add reference to this ticket number
set_mail_to_header.2.diff (2.4 KB) - added by Ethan Jucovy 5 years ago.
Allow custom To headers

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by Ethan Jucovy

Attachment: set_mail_to_header.diff added

add reference to this ticket number

Changed 5 years ago by Ethan Jucovy

Attachment: set_mail_to_header.2.diff added

Allow custom To headers

comment:1 Changed 5 years ago by anonymous

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

+1. This would be useful for me too.

comment:2 Changed 5 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted

The patch looks good to me.

comment:3 Changed 5 years ago by Aymeric Augustin

Triage Stage: AcceptedReady for checkin

comment:4 Changed 5 years ago by Aymeric Augustin

Resolution: fixed
Status: newclosed

In [17293]:

Fixed #17444 -- Made it possible to customize the 'To' header in emails.

Note: See TracTickets for help on using tickets.
Back to Top