<p>I have been trying to find information on how to retrieve attachments from a gmail account in either python or PHP, I'm hoping that someone here can be of some help, thanks.</p>

<p>Related:</p>

<ul>
<li><a href="https://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail">How can I download all emails with attachments from Gmail?</a></li>
</ul>

You will have to enable IMAP access to your GMail account (Settings → Forwarding and POP/IMAP), and then use
```
imaplib.IMAP4_SSL
```
to access it.
Use the raw text of every message as an argument to
```
email.message_from_string
```
in order to process any attachments.