-
Notifications
You must be signed in to change notification settings - Fork 459
Examples of usage
Yevgen Sh edited this page Mar 20, 2018
·
11 revisions
$mailbox = new PhpImap\Mailbox(
'{imap.gmail.com:993/ssl/novalidate-cert/imap}',
'example@gmail.com',
'password',
false // when $attachmentsDir is false we don't save attachments
);
// get the list of folders/mailboxes
$folders = $mailbox->getMailboxes('*');
// loop through mailboxs
foreach($folders as $folder) {
// switch to particular mailbox
$mailbox->switchMailbox($folder['fullpath']);
// search in particular mailbox
$mails_ids[$folder['fullpath']] = $mailbox->searchMailbox('SINCE "24 Jan 2018" BEFORE "25 Jan 2018"');
}
var_dump($mails_ids);
$mailbox = new PhpImap\Mailbox(
'{outlook.office365.com:993/imap/ssl}',
'example@gmail.com',
'password',
__DIR__,
'US-ASCII' // force charset different from UTF-8
);
// Calls imap_check();
// http://php.net/manual/en/function.imap-check.php
$info = $mailbox->imap('check');
// Show current time for the mailbox
$current_server_time = isset($info->Date) && $info->Date ? date('Y-m-d H:i:s', strtotime($info->Date)) : 'unknown';
echo $current_server_time;