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.
You can use functions:
$imap = ximap_open("{imap.example.org}", "[email protected]","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}", "[email protected]","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);