Search code examples
phpimaphorde

PHP Imap extension vs. Horde Framework imap client (or other alternatives)


For a web application I need to read mails from an imap server with php.

So far i have used a very simple script and the php imap extension, but because i need a robust solution (i also tried pear imap packages, but it was not very reliable with different encodings), that supports more features like pgp encrypted emails, i have been thinking about using the horde framework/imap client instead.

I don't know if it's worth to install and use the (rather complex) horde framework just for the imap functions. Are there any alternatives or suggestions? what would be the advantages/disadvantages of using horde vs the php imap extension?

(The application is not supposed to provide any webinterface, i just need to parse mails and save contents/attachements to a database)

UPDATE I tried the Horde Imap Client, it's easy to install and use, but the performance seems a little bit slow compared to the php imap extension (on php5.3+eAccelerator). Login on imap server + fetch headers takes 8 seconds (login 4.5s + fetch headers 3.5s), compared to less than 4 seconds with php imap extension (login 3s + fetch headers 0.5s). I'm still trying to figure out wether i'm doing something wrong or this is just the normal difference between a native php library vs php imap extension.


Solution

  • You can install the Horde IMAP library without setting up the whole framework too:

    $ pear channel-discover pear.horde.org
    $ pear install horde/horde_imap_client