Parsing Email Headers

Grant Edwards invalid at invalid.invalid
Thu Mar 11 15:20:56 EST 2010


On 2010-03-11, T <misceverything at gmail.com> wrote:
> All I'm looking to do is to download messages from a POP account and
> retrieve the sender and subject from their headers.  Right now I'm 95%
> of the way there, except I can't seem to figure out how to *just* get
> the headers.

The headers are saparated from the body by a blank line.

> Problem is, certain email clients also include headers in the message
> body (i.e. if you're replying to a message), and these are all picked
> up as additional senders/subjects.  So, I want to avoid processing
> anything from the message body.

Then stop when you see a blank line.

Or retreive just the headers.

-- 
Grant Edwards               grant.b.edwards        Yow! My life is a patio
                                  at               of fun!
                              gmail.com            



More information about the Python-list mailing list