Reputation: 51
I am looking for PHP class, that helps me read emails and their attachments.
I tried to write it on my own with IMAP class in PHP, but emails exists in many, many formats. And it is complicated to include all of them to get some reasonable text output.
It should look something like this:
$mailbox = Mailbox("{localhost:993/imap/ssl}INBOX", "user_id", "password");
$unreadMessages = $mailbox->unreadMessages(); // just ids
$message = $mailbox->getMessage(5); // headers and body in plain text, ids of attachments
$message->saveAttachment(1, '/path/to/attachments/folder');
$message->seen();
Thanks for help!
Upvotes: 3
Views: 5171
Reputation: 62369
I use Mail
component from Apache Zeta Components. It's really easy to use. I had a working prototype in under one hour.
Upvotes: 3
Reputation: 2870
Check out Zend_Mail
- it has lots of options, you will probably find everything you need. Maybe not as simple as your code above, but as you said yourself, there are a lot of options.
http://framework.zend.com/manual/en/zend.mail.read.html
Upvotes: 1