1. Go to this page and download the library: Download israelfl/imap-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
israelfl / imap-client example snippets
$mailbox = 'my.imapserver.com';
$username = 'myuser';
$password = 'secret';
$encryption = 'tls'; // or ssl or '';
$imap = new Imap($mailbox, $username, $password, $encryption);
if($imap->isConnected()===false) {
die($imap->getError());
}
$folders = $imap->getFolders(); // returns array of strings
foreach($folders as $folder) {
echo $folder;
}