Download POP3/IMAP Email Attachments with PHP
How to download email attachments via PHP
I found this niftly little class on phpclasses.org. Basically, it logs in to an email server and downloads all email attachments and saves them as files. That's basically it, no more, no less.
This was exactly what I needed though. I wanted to run some daily reports in Google AdWords and Google AdSense, to a specific email address, then process those reports on a daily basis to customize my own reports... in a nutshell.
I did make a few updates to this class.
$savedirpathvariable was not utilized. It simply saved the files in the same location as the script. I had it implement this parameter.
- I added another parameter to delete emails after downloading the attachments. Luckily for me, when I went to add the code, I found it was already there, just commented out.
- Tidied up the code a bit to make it more readable for me.