PHP code example of acucchieri / php-imap
1. Go to this page and download the library: Download acucchieri/php-imap 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/ */
acucchieri / php-imap example snippets
composer
php
use AC\Imap\Imap;
$imap = new Imap([
'host' => 'imap-server.domain.tld', // Hostname. Required
'port' => 143, // Host port. Default : 143
'folder' => 'INBOX', // Mailbox name. Default : 'INBOX'
'user' => 'user-login', // Login. Required
'password' => 'user-password', // Password. Required
'flags' => [], // Connection flags. Optionnal
'lazy' => false, // Lazy mode. Default : false
]);
/** @var \AC\Imap\Collection\MessageCollection $result */
$result = $imap->search('FROM "[email protected]"');
foreach ($result as $message) {
/** @var \AC\Imap\Message $message */
var_dump($message->getSubject());
}