Hi All,
Been a bit bored, so went at it to create a class from some long procedural stuff I found littered in various guises all over the web. The code I used as a base for the class came from here. As this uses IMAP functions and many of you out there use XAMPP on your local machines, ensure that you enable it in php.ini before testing this script. Search the file for ;extension=php_imap.dll
and take off the preceding semi-colon to leave extension=php_imap.dll
. Save the file. You then need to restart Apache.
Usage is pretty simple - just three public methods:
The constructor
just creates an imap stream and takes connection info.get_files()
"downloads" attachments to a location of your choice. You can specify the search terms to effectively limit the results to one email.extract_zip_to()
simply extracts any downloaded zip files to a specified location.
BTW, I have no idea why the code parser has mangled my indenting. Apologies, but it looks nothing like that in my IDE.