Add header at top with email.message
Jason Friedman <jsf80238 at gmail.com> writes:
> I suppose you already figured out that you can call __delitem__() to
> clear the headers and add them back in whatever order you like.
Well, this would mean saving all headers, deleting all, inserting my
own, and adding the saved original headers again. Seems complicated.
> I'm interested in learning more about your use case. Do you have a
> third party with fixed logic that requires the headers in a particular
Yes, RFC 5321, section 4.4 :)
> When an SMTP server receives a message for delivery or further
> processing, it MUST insert trace ("time stamp" or "Received")
> information at the beginning of the message content, as discussed in
> Section 220.127.116.11.
To trace the path a message went, those headers do need to be in a
particular order, or else they won?t make any sense.