way to extract only the message from pop3

kyosohma at gmail.com kyosohma at gmail.com
Tue Apr 3 15:45:38 EDT 2007


On Apr 3, 2:36 pm, "flit" <superf... at gmail.com> wrote:
> Hello All,
>
> Using poplib in python I can extract only the headers using the .top,
> there is a way to extract only the message text without the headers?
>
> like remove the fields below:
> "
> Return-Path:
> X-Original-To:
> Received: from [
>         by (Postfix) with ESMTP id B32382613C
>         for  Tue,  3 Apr 2007 09:54:28 -0300 (BRT)
> Date: Tue, 03 Apr 2007 09:52:15 -0300
> From:  <@>
> To:
> Subject: test
> Message-Id:
> MIME-Version: 1.0
> Content-Type: text/plain; charset="US-ASCII"
> Content-Transfer-Encoding: 7bit
> X-Mailer: Becky! ver. 2.24.02 [en]
> X-UIDL: !Dn!!HKT!!/k
> Status: RO
> "
> and only get this:
>
> this is a text message..
> ..
>
> Thanks



I found a tutorial on parsing email that should help you:

http://www.devshed.com/c/a/Python/Python-Email-Libraries-SMTP-and-Email-Parsing/

Also see the email module:

http://www.python.org/doc/2.3.5/lib/module-email.html

Mike




More information about the Python-list mailing list