Fetching attachments from gmail via either python or php

后端 未结 5 1041
终归单人心
终归单人心 2021-02-06 09:33

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.

5条回答
  •  情话喂你
    2021-02-06 10:13

    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.

提交回复
热议问题