Re: Download an attachment from an IMAP email

2011-02-04 Thread Vincent Davis
hgc


On Thu, Feb 3, 2011 at 6:52 PM, Kushal Kumaran 
kushal.kumaran+pyt...@gmail.com kushal.kumaran%2bpyt...@gmail.com wrote:

 On Fri, Feb 4, 2011 at 3:44 AM, Vincent Davis vinc...@vincentdavis.net
 wrote:
  I have a few emails I am trying to download from my google account. I
 seem
  to be getting the message but each of these messages have an attachment.
 I
  don't understand what I ned to do to get and save the attachment to a
 local
  file.
  Here is what I have so far.
  M = imaplib.IMAP4_SSL(IMAP_SERVER, IMAP_PORT)
  rc, resp = M.login('x@', 'X')
  print rc, resp
  M.select('[Gmail]/All Mail')
  M.search(None, 'FROM', 'some...@logitech.com')
  #M.fetch(121, '(body[header.fields (subject)])')
  M.fetch(121, '(RFC822)')

 Take a look at the email module.  The message_from_string() function
 can convert the string representation of the email (as obtained by
 M.fetch(121, '(RFC822)') into a message object.


Thanks
Vincent


 --
 regards,
 kushal




-- 
Thanks
Vincent Davis
720-301-3003
-- 
http://mail.python.org/mailman/listinfo/python-list


Download an attachment from an IMAP email

2011-02-03 Thread Vincent Davis
I have a few emails I am trying to download from my google account. I seem
to be getting the message but each of these messages have an attachment. I
don't understand what I ned to do to get and save the attachment to a local
file.
Here is what I have so far.
M = imaplib.IMAP4_SSL(IMAP_SERVER, IMAP_PORT)
rc, resp = M.login('x@', 'X')
print rc, resp
M.select('[Gmail]/All Mail')
M.search(None, 'FROM', 'some...@logitech.com')
#M.fetch(121, '(body[header.fields (subject)])')
M.fetch(121, '(RFC822)')

-- 
Thanks
Vincent Davis
720-301-3003
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Download an attachment from an IMAP email

2011-02-03 Thread Kushal Kumaran
On Fri, Feb 4, 2011 at 3:44 AM, Vincent Davis vinc...@vincentdavis.net wrote:
 I have a few emails I am trying to download from my google account. I seem
 to be getting the message but each of these messages have an attachment. I
 don't understand what I ned to do to get and save the attachment to a local
 file.
 Here is what I have so far.
 M = imaplib.IMAP4_SSL(IMAP_SERVER, IMAP_PORT)
 rc, resp = M.login('x@', 'X')
 print rc, resp
 M.select('[Gmail]/All Mail')
 M.search(None, 'FROM', 'some...@logitech.com')
 #M.fetch(121, '(body[header.fields (subject)])')
 M.fetch(121, '(RFC822)')

Take a look at the email module.  The message_from_string() function
can convert the string representation of the email (as obtained by
M.fetch(121, '(RFC822)') into a message object.

-- 
regards,
kushal
-- 
http://mail.python.org/mailman/listinfo/python-list