Php – Processing IMAP email in PHP

cakephpemailimapPHP

I need to process an email inbox, monitor it for messages with a particular subject line. If it finds a match I need to get the body content, manipulate, and insert into a database. Ideally would mark the message as read and move it to another IMAP folder as well.

I'm poking around PHP documentation imap_open (http://us2.php.net/imap_open) and found a link http://www.linuxscope.net/articles/mailAttachmentsPHP.html#_jmp0_

Before I get too far, I'm wondering if anyone is aware of an existing PHP class that's a good wrapper for the basics I'm looking for:

IMAP:

  • connect
  • list folders
  • list messages
  • read messages – from, to, subject, body
  • move messages to server folders
  • read/unread status

Thank you!

Best Answer

I've not used it for anything but sending mail, but it appears that the Zend_Mail component will get you at least most of the way there. It doesn't seem to support moving messages on the server, but you could probably extend it fairly simply.