[dev] imap client

Thomas Jarosch thomas.jarosch at intra2net.com
Tue Jul 9 14:09:15 UTC 2019


Hi Andrea,

You wrote on Tue, Jul 09, 2019 at 02:23:22PM +0200:
> kinda newbie here. I've installed imap client through pear, and I need to
> use it in my laravel project.
> Can somebody explain how to auto load it?

here's a code snippet I use in a small script:


define("HORDE_BASE", "/usr/share/pear/Horde");
require_once HORDE_BASE . "/Autoloader/Default.php";

..

$imap = new Horde_Imap_Client_Socket(array("username" => $username,
                                           "password" => $password,
                                           "hostspec" => COLLECTOR_HOST,
                                           "port" => COLLECTOR_PORT,
                                           "secure" => false));

// Determine IMAP delimiter
$namespaces = $imap->getNamespaces();
$last_namespace = array_pop($namespaces);
$imap_delimiter = $last_namespace['delimiter'];

// --- Get the list of folders ("mailboxes" in IMAP speak) in that user's account from the server --------------------
$folders = $imap->listMailboxes("*", Horde_Imap_Client::MBOX_ALL, array("flat" => true));




HTH,
Thomas


More information about the dev mailing list