On Dec 20, 6:57 am, Chris <[EMAIL PROTECTED]> wrote: > On Dec 20, 9:22 am, los117 <[EMAIL PROTECTED]> wrote: > > > > > > > I am trying to fetch email from gmail, but what I am really interested > > is theattachment. > > I manage to access the gmail server and get the messege but the > >attachmentcame as text: > > > "------=_Part_5286_15861975.1197955173158 > > Content-Type: audio/mpeg; name="Dire Straits - 12 - Calling Elvis.mp3" > > Content-Transfer-Encoding: base64 > > X-Attachment-Id: f_fabzd5l20 > > Content-Disposition:attachment; > > filename="Dire Straits - 12 - Calling Elvis.mp3" > > > // > > ugbAAP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA-A..." > > > how do i manage to get the file? I google for a while now, but I am a > > bit lost of ideas. Sorry for the noobish and the english. thanks =D > > the base64 string you started quoting is theattachment. > from base64 import decodestring > fout = open( filename_from_email, > 'w' ).write( decodestring( string_you_parsed_from_the_email ) ) > > also look at the email module, there are some functions to get the > payload of the email for you.- Hide quoted text - > > - Show quoted text -
-- http://mail.python.org/mailman/listinfo/python-list