Mail and text extraction

Nomad nomad*** at ***
Mon Apr 21 22:07:50 CEST 2003

On Mon, 21 Apr 2003 01:45:55 +0200, Gerhard Häring <gh at>

>* Dino Levy <dino_levy at> [2003-04-21 01:19 +0200]:
>> I have the following problem:
>> I'm trying to make a script which will connect to POP3 server, print
>> number of mails, print their size and subject, and then will ask the user
>> which mail should be downloaded...
>> So far so good, but I have problem: 
>> [...]
>> The
>> mail looks like this:
>> Agnell company
>> -Worker		Payment
>> Joe Doe		500$
>> Mary Smith	550$
>> Karen Bay	495$
>> -New Employee: Peter Maley
>> some text...
>> -Raises:
>> some text
>> And all you want to do is to connect to your POP3 server, and download
>> the section called Raises ( for example, two or three lines after the
>> title ), so all you want to do is to download those few lines containing your
>> text... ( ONLY those lines, not the whole e-mail ) [...]
>AFAIK, the POP3 protocol doesn't support downloading parts of emails. To
>my knowledge, you can either download the headers (via TOP) or the body
>(via RETR).

TOP takes two arguments, the message number (from LIST) and the number
of lines of the body to retrieve (eg TOP 1 1 gives you the headers and
one line of message).

RETR returns the whole rfc*822 message, both headers and body.

Just my 2p.


Wondering of the vast emptyness of the 'net
in search of something cool.

More information about the Python-list mailing list