Retrieve Email Attachments
Fazer
faizan at jaredweb.com
Fri May 14 21:29:46 EDT 2004
Thanks a lot for your guide!
Lutz Horn <lho at gmx.de> wrote in message news:<2gj7b8F3fd4cU2 at uni-berlin.de>...
> Lutz Horn wrote:
> > Use poplib or imaplib to get a message as a string.
> >
> > >>> import poplib
> > >>> connection = poplib.POP3("servername")
> > >>> connection.user("username")
> > >>> connection.pass_("password")
>
> forgot:
>
> >>> msg_as_string = connection.get(number_of_message_on_server)
>
> > Then use the email module (new in 2.2) to parse this string into an
> > instance of email.Messsage using
> >
> > >>> import email
> > >>> msg = email.message_from_string(msg_as_string)
> >
> > Use the methods of the resulting email.Message instance to get the
> > contents of the email.
More information about the Python-list
mailing list