I'm not familiar with that package, but Zend Mail works really well and has a comprehensive documentation.
May 9, 2018
15
Level 4
PHP-imap get all mail
Hi Guys
Another question on Email. I m using php-imap package to get all mail from a Gmail account.
Now I can get a single message but what I'm struggling to do is get all mail at once
public function GetMail() {
$mailbox = new PhpImap\Mailbox('{imap.gmail.com:993/imap/ssl}INBOX', '[email protected]', 'password', __DIR__);
// Read all messaged into an array:
$mailsIds = $mailbox->searchMailbox('ALL');
if(!$mailsIds) {
return ('Mailbox is empty');
}
// Get the first message and save its attachment(s) to disk:
$mail = $mailbox->getMail($mailsIds[1]);
dd($mail);
}
if I remove the [1] I get the error of 'cant get property of non-object'
The docs are pretty slim to be honest so just wondering if anyone has any experience with the package and have managed to do what I'm trying to do
Please or to participate in this conversation.