Webklex / php-imap

PHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled. The protocol is completely integrated and therefore supports IMAP IDLE operation and the "new" oAuth authentication process as well.
https://www.php-imap.com
MIT License
314 stars 145 forks source link

Get "ARRIVALDATE" from server #299

Open AzzaAzza69 opened 2 years ago

AzzaAzza69 commented 2 years ago

Is your feature request related to a problem? Please describe. I need to present to the user the "oldest" message per folder/s & mailboxes and the times are different than that of the Outlook client.

Describe the solution you'd like The inclusion of the "ARRIVALDATE" from the server.

Describe alternatives you've considered It was available in php imap_fetch_overview but as this library does not support oauth2, I have had to re-write.

Additional context This was what I had:

$aList=imap_fetch_overview($mbox, $nMsgId)
$oMsg=$aList[array_key_first($aList)];
$oDate=new DateTime();
$oDate->setTimestamp($oMsg->udate);
Webklex commented 2 years ago

Hi @AzzaAzza69 , thanks for the suggestion. I don't know how the clib used to fetch the arrival date - or where the udate comes from. I would have thought that it simply takes the Date header value as arrival date (as most clients do), but it could be that this isn't the case and the mail server actually makes the arrival date available somehow. If you, or someone else know any rfc references, please post them below :)

Best regards,

AzzaAzza69 commented 2 years ago

I found a reference to it in the php imap module source: https://github.com/php/php-src/blob/master/ext/imap/php_imap.c line #1546 refers to "udate" But as I don't have a better grasp on the intricacies I can't follow it very well...HTH