freescout-helpdesk / ximap

Replacement for PHP IMAP extension. Supports XOAUTH2-authentication.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ximap

Wrapper around Zend Mail providing same set of functions as PHP IMAP but with x-prefix (ximap_open, ximap_fetchbody, ximap_list, etc.) for easier migration from PHP IMAP extension. Supports XOAUTH2-authentication. PHP IMAP does not support and will not support OAuth-authentication, this is the reason for creating Ximap.

If PHP IMAP extension is installed and no OAuth-authentication is needed, Ximap automatically falls back to the native PHP IMAP extension functions.

Usage

You can use functions:

$imap = ximap_open("{imap.example.org}", "sample@example.com","password");

$list = ximap_list($imap, "{imap.example.org}", "*");
if (is_array($list)) {
    foreach ($list as $val) {
        echo ximap_utf7_decode($val) . "\n";
    }
} else {
    echo "imap_list failed: " . ximap_last_error() . "\n";
}

ximap_close($imap);

Or you can use Ximap\Imap class:

$ximap = Ximap\Imap("{mail.example.com:143}", "sample@example.com","password");

$list = $ximap->imap_list();
if (is_array($list)) {
    foreach ($list as $val) {
        echo $ximap->imap_utf7_decode($val) . "\n";
    }
} else {
    echo "imap_list failed: " . $ximap->imap_last_error() . "\n";
}

$ximap->imap_close($imap);

About

Replacement for PHP IMAP extension. Supports XOAUTH2-authentication.

License:GNU General Public License v3.0


Languages

Language:PHP 100.0%