Email module, how to add header to the top of an email?

David Erickson halcyon1981 at gmail.com
Fri Jan 25 00:21:59 EST 2008


On Jan 24, 2:41 pm, Martin Marcher <mar... at marcher.name> wrote:
> On Thursday 24 January 2008 20:32 David Erickson wrote:
>
> > I have been using the Email module and Message class for awhile,
> > however I have been unable to find a way to add a header to the top of
> > the email similar to what is done with Received: headers... the
> > add_header method only appends to the bottom.  Is there someway this
> > can be done?
>
> if by bottom you mean added as the "new last" header than you don't have to
> care, afaik email headers do not have a notion of order
>
> e.g
>
> To: b... at example.com
> From: al... at example.com
>
> is equal to
>
> From: al... at example.com
> To: b... at example.com
>
> if by bottom you mean it's appended to the body...well that is a problem :)
>
> hth
> martin

Bottom of the headers... but I am looking to insert at the top, and re-
ordering/inserting does matter depending on what type of header you
are, received headers for example must be inserted at the top of the
header list so you can watch the progression of the email.  I was
unable to find a clean way to do this via the API which seems very
strange to me.. but perhaps I am just missing something?

Thanks,
-David



More information about the Python-list mailing list