How to save image attachment from email using IMAP

2019-07-29 14:55发布

问题:

I've successfully written script that connects to my mail server and retrieves the headers and bodies of all new messages. I want to take it one step further to detect if attachment exists (images only), if so, download to server.

How to go about this using PHP & IMAP?

Thanks in advance

回答1:

Attachments would be MIME encoded - it's fairly simple to parse and check the contents.

Images would have an image MIME content type.