Tutorial :reading mail from PHP



Question:

i am searching for a way to read mail messages from a PHP application, including access to attachments etc. imap functions are not acceptable as a solution, as this application will handle mails with heavy attachments.

i have full access to the server's mail folder from php via filesystem. any thoughts?


Solution:1

I think you could use a combo of the Pear packages Mail_Mbox and Mail_mimeDecode. Use Mail_Mbox to read new mail from the inbox, one message at a time, and use Mail_mimeDecode to extract the attachements. All this will be done w/o IMAP. You can then save the read messages to a different mbox to keep the inbox clean.

Pear - Mail_Mbox
Pear - Mail_MimeDecode


Solution:2

I had a question like this a while back. See if any of the answers help you: How to get email and their attachments from PHP

postfix + maildrop was the solution I ended up taking, It routes the emails through to a PHP script when it arrives and in my case, the PHP does something with the attachment. But I only needed to read each email once. If you need to be able to browse all the emails, you either need to store the results of maildrop or find another solution.

If you need to full access to all emails, POP and IMAP are popular choices because they do work. I'm not sure why you're against them.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »