In my project, emails are sent to `Cc:` or `Bcc:` recipients without a
`To:` recipient.
Some mail backends are very strict about allowed headers and their values.
For example, Amazon Simple Email Service (SES) validates all recipient
headers to contain valid email addresses. It fails without delivery if any
header contains an invalid address. For some details, see:
https://boto3.readthedocs.io/en/latest/reference/services/ses.html#SES.Client.send_raw_email
> The message must include at least one recipient email address. The
recipient address can be a To: address, a CC: address, or a BCC: address.
If a recipient email address is invalid (that is, it is not in the format
UserName@[SubDomain.]Domain.TopLevelDomain ), the entire message will be
rejected, even if the message contains other recipients that are valid.
SES considers blank as invalid. When sending an email serialized by
`EmailMessage.message()` to `Cc:` or `Bcc:` only addresses, SES fails with
an error. `To:` avoid the error, Django can avoid setting the To header
when `EmailMessage.to` is empty.
--
Ticket URL: <https://code.djangoproject.com/ticket/28912>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/9454 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/28912#comment:1>
* stage: Unreviewed => Accepted
Comment:
Makes sense.
--
Ticket URL: <https://code.djangoproject.com/ticket/28912#comment:2>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/28912#comment:3>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"da82939e5a31dea21a4f4d5085dfcd449fcbed3a" da82939]:
{{{
#!CommitTicketReference repository=""
revision="da82939e5a31dea21a4f4d5085dfcd449fcbed3a"
Fixed #28912 -- Made EmailMessage.message() omit an empty To header.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28912#comment:4>