PHP code example of particlebits / imap
1. Go to this page and download the library: Download particlebits/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/ */
particlebits / imap example snippets
$mailbox = new \Pb\Imap\Mailbox(
'imap.gmail.com',
'[email protected]',
'**********',
'INBOX',
__DIR__ .'/attachments',
[
\Pb\Imap\Mailbox::OPT_DEBUG_MODE => true
]);
$messageIds = $mailbox->searchMailBox('ALL');
foreach ($messageIds as $messageId) {
$message = $mailbox->getMessage($messageId);
print_r($message);
print_r($message->getAttachments());
}