benhall14/php-imap-reader

exampel

Closed this issue · 6 comments

Help and example example for using single email mode with id.

$imap = new Reader(IMAP_MAILBOX, IMAP_USERNAME, IMAP_PASSWORD, ATTACHMENT_PATH); 
$imap
->id($_GET['em'])	
->get();		
foreach ($imap->emails() as $email) {
    echo 'SUBJECT: '.$email->subject().'<br/>';		
    echo 'SENDER: '.$email->fromEmail();                  
    echo '  --- '.$email->date('Y-m-d H:i');
	echo '<hr/>'.$email->plain();
    echo '<hr/>';
}

not show!

I've tested your code on PHP 7.4 and it works as expected?

A few things to check:
-- Are you defining the IMAP_MAILBOX, IMAP_USERNAME, IMAP_PASSWORD, and ATTACHMENT_PATH?
-- Are you using the correct id? This is the message sequence number as opposed to the message UID. If you use the UID, it won't return the correct message.
-- Are any error messages showing?

I think the issue is down to the wrong ID. On individual emails, the ->id() return the UID, but when you're setting up using the id(x)->get(), it's expecting the message stream number NOT the UID.

I'm guessing that you're using the UID in the id(x)->get() call which isn't returning the correct email as it's not matching your id.

I'm looking into updating a few things to make this clearer and providing a workable solution, but I don't have an ETA on when it will be updated yet.

If possible, write an example of coding with $imap->id()
thanks

i checked and find problem in ID ;
showin ID in get(); working for delete & unseen &....
But not working for specific getEmail()

The latest version (1.1) uses a clearer solution with the email ID.
You can use the id(x)->get() as per your original message and the results should now return as expected.