Skip to content


Subversion checkout URL

You can clone with
Download ZIP
An IMAP library for PHP
PHP Shell
Latest commit 3fbee9 @tedivm tedivm Merge pull request #147 from linniksa/patch-mime-decoder
Provide mime text decoder by RFC2047

Fetch Build Status

License Latest Stable Version Coverage Status Total Downloads

Fetch is a library for reading email and attachments, primarily using the POP and IMAP protocols.


N.b. A note on Ubuntu 14.04 (probably other Debian-based / Apt managed systems), the install of php5-imap does not enable the extension for CLI (possibly others as well), which can cause composer to report fetch requires ext-imap

sudo ln -s /etc/php5/mods-available/imap.ini /etc/php5/cli/conf.d/30-imap.ini


Installing Fetch can be done through a variety of methods, although Composer is recommended.

Until Fetch reaches a stable API with version 1.0 it is recommended that you review changes before even Minor updates, although bug fixes will always be backwards compatible.

"require": {
  "tedivm/fetch": "0.6.*"


Fetch is also available through Pear.

$ pear channel-discover
$ pear install tedivm/Fetch


Releases of Fetch are available on Github.

Sample Usage

This is just a simple code to show how to access messages by using Fetch. It uses Fetch own autoload, but it can (and should be, if applicable) replaced with the one generated by composer.

$server = new \Fetch\Server('', 993);
$server->setAuthentication('dummy', 'dummy');

$messages = $server->getMessages();
/** @var $message \Fetch\Message */
foreach ($messages as $message) {
    echo "Subject: {$message->getSubject()}\nBody: {$message->getMessageBody()}\n";


Fetch is licensed under the BSD License. See the LICENSE file for details.

Something went wrong with that request. Please try again.