How to retrive attached file from newsgroup mail

Alex Martelli aleax at aleax.it
Tue Apr 30 04:51:07 EDT 2002


sanjay wrote:

>   Im using NNTP to retrive the newsgroups mails to display on web
> pages.The email is multipart i,e text/html with doc,pdf,gif file has
> attached. Is there any python script to get all the plain text/html
> message with attached file from mail.

Yes, there are Python modules in the standard library to let you
perform such tasks easily.  Most general and powerful is package
'email', that comes with Python 2.2 (but can also be downloaded and
installed separately on 2.1, I believe).  See, e.g.:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/86676

for a simple example.


Alex




More information about the Python-list mailing list