An already working PHP script for retrieving emails using PHP IMAP needs functionality for storing email attachments on server.
* All file types / MIME types must be supported
* Error handling (if saving an attachment fails, this needs to be sent to an admin)
* File names must be safely encrypted
* Attachments must be registered in a database table (MySQL), linking each attachment to its file, an