<font size="2"><font face="arial,helvetica,sans-serif"><br></font></font><br><div id="WISESTAMP_SIG_9309"><span style="font-size: 13.3px; font-family: Verdana,Arial,Helvetica,sans-serif;"><div style="margin: 0pt 0pt 8px;">
<p style="margin: 0pt;">hgc</p></div><img src="http://s.wisestamp.com/pixel.png?p=mozilla&v=2.0.5&t=1296850874579&u=5735731&e=7078" height="1" width="1"></span></div><br><br><div class="gmail_quote">On Thu, Feb 3, 2011 at 6:52 PM, Kushal Kumaran <span dir="ltr"><<a href="mailto:kushal.kumaran%2Bpython@gmail.com">kushal.kumaran+python@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">On Fri, Feb 4, 2011 at 3:44 AM, Vincent Davis <<a href="mailto:vincent@vincentdavis.net">vincent@vincentdavis.net</a>> wrote:<br>

> I have a few emails I am trying to download from my google account. I seem<br>
> to be getting the message but each of these messages have an attachment. I<br>
> don't understand what I ned to do to get and save the attachment to a local<br>
> file.<br>
> Here is what I have so far.<br>
> M = imaplib.IMAP4_SSL(IMAP_SERVER, IMAP_PORT)<br>
> rc, resp = M.login('xxxxx@xxxx', 'XXXXX')<br>
> print rc, resp<br>
> M.select('[Gmail]/All Mail')<br>
> M.search(None, 'FROM', '<a href="mailto:someone@logitech.com">someone@logitech.com</a>')<br>
> #M.fetch(121, '(body[header.fields (subject)])')<br>
> M.fetch(121, '(RFC822)')<br>
<br>
</div></div>Take a look at the email module.  The message_from_string() function<br>
can convert the string representation of the email (as obtained by<br>
M.fetch(121, '(RFC822)') into a message object.<br></blockquote><div><br>Thanks<br>Vincent <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<br>
--<br>
regards,<br>
<font color="#888888">kushal<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Thanks<div>Vincent Davis</div><div>720-301-3003<span></span><span></span></div><br>