I am looking for a php/pearl based script that will login to a specified email address and download all messages and insert them into a mySql database. All the information from the emails will need to be stored in the database to be referenced at a later point. Listed below are the main functions.
1. It will connect to multiple email address's at different times and need to log them (example: sales@[login to view URL], billing@[login to view URL])
2. It will need to strip out all inline images/files and store them on the server referencing them as attachments
3. When a email is found, it should FWD the email (without changing any items where inline text etc should still work) to a specified email address
4. After the email has been FWD and imported into the database, it should remove the email from the server so it does not reimport again
5. Script will be running as a CRON. The server is currently running PHP Version 4.4.4 and i have full access to the server. If detailed specs are given, I can install anything on the server.
I currently do not have a database layout for how the mail should be stored but below is my thoughts which I am open to changes to imporve the structure.
Messages
Message_ID
Message_ParentMessageID
Message_Subject
Message_BodyOriginal
Message_BodyHTML
Message_BodyText
Message_DateTime
Message_From
Message_To
Message_Folder enum('Inbox','Outbox')
Message_Read enum('Yes', 'No')
Message_Status enum('New', 'Completed', 'Deleting')
Message_Attachment
MessageAttachment_ID
MessageAttachment_MessageID
MessageAttachment_FileName
MessageAttachment_FileNameSaved
MessageAttachment_FileSize