complex FETCH using IMAPLIB

Donn Cave donn at u.washington.edu
Thu Dec 30 12:18:58 EST 1999


Quoth "Asle Pedersen" <apederse at siving.hia.no>:
| Are anyone familiar with the imaplib.py?? I manage to get all the simple
| functions working but I'm bit unsure of the syntax with more complicated
| commands. I have the book Programming Internet Email where there is a FETCH
| command that looks like:
| DF56 FETCH 1:3 (RFC822.SIZE BODY[HEADER.FIELDS (FROM SUBJECT)]).
| This is supposed to work from a telnet session to a mailserver, but how will
| I do this with the IMAPLIB??
| There is no problems with commands like:
| typ, data = M.FETCH(1, 'BODY')

In my mailer I get headers like this:
	ok, stuff = service.fetch('%d:%d' % (first, last), '(FLAGS RFC822.HEADER)')

and I haven't tried it, but I reckon you could substitute '(RFC822.SIZE ...)'
for my '(FLAGS ...)'.  I have been meaning to look into some smarter header
fetch myself, since the full headers can be awful slow to download.

	Donn Cave, University Computing Services, University of Washington
	donn at u.washington.edu



More information about the Python-list mailing list