for example:
{{{
from django.core.mail import EmailMessage
email = EmailMessage(
'Example Subject',
'Here is the message.',
'fr...@example.com',
to=['t...@example.com'],
headers={'x-unique-id': 'unique_id',
'X-email-id-trace ':'trace_id'},
)
email.send(fail_silently=False)
}}}
Since we pass **headers** using a **dict** i need to create up unique keys
for headers so this is the reason i am not being able to send duplicate
email headers,
i came across this case when i tried to implement AWS SES Logging where i
need to send multiple headers of same name like,
{{{
headers={'X-SES-CONFIGURATION-SET': 'emailLogs',
'X-SES-MESSAGE-TAGS ':'uid=uid',
'X-SES-MESSAGE-TAGS':'sub=sub',
'X-SES-MESSAGE-TAGS':'dom=dom'},
}}}
There are/can be multiple workarounds to deal with it but i will be happy
to see this implemented in django core itself
I am happy to work on it if it needs to be implemented as a new feature to
allow duplicate headers name
--
Ticket URL: <https://code.djangoproject.com/ticket/32907>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Adam Johnson):
I checked the RFC (
https://datatracker.ietf.org/doc/html/rfc5322#section-3.6 ) and only
certain email headers are listed as allowed to occur more than one time.
The SES header does not appear there.
I checked the SES documentation and it recommends passing multiple tags in
one header, separated by commas. This may be what you want to do:
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/event-publishing-
send-email.html#event-publishing-using-ses-headers
--
Ticket URL: <https://code.djangoproject.com/ticket/32907#comment:1>
* status: new => closed
* resolution: => invalid
Comment:
IMO there is no need for a new API, you should be able to pass multiple
values in a single string, e.g. `'X-SES-MESSAGE-TAGS ': 'uid=uid, sub=sub,
dom=dom'`, see also TicketClosingReasons/UseSupportChannels for ways to
get help.
--
Ticket URL: <https://code.djangoproject.com/ticket/32907#comment:2>
Comment (by Mariusz Felisiak):
Thanks Adam for extra details.
--
Ticket URL: <https://code.djangoproject.com/ticket/32907#comment:3>