开发者

"X-GM-THRID" via imap php

开发者 https://www.devze.com 2023-02-24 12:44 出处:网络
Vivek, could you give an ex开发者_如何转开发ample HOWTO grab \"X-GM-THRID\" via imap php?It\'s simple with Zend\'s IMAP class. The IDs in the web interface are supposed to be HEX versions of the same

Vivek, could you give an ex开发者_如何转开发ample HOWTO grab "X-GM-THRID" via imap php?


It's simple with Zend's IMAP class. The IDs in the web interface are supposed to be HEX versions of the same number Gmail expects through IMAP (http://www.limilabs.com/blog/tag/x-gm-thrid), tough I'm still having trouble using those because if I convert them from HEX the numbers are a bit off.

$imap = new Zend\Mail\Protocol\Imap('imap.gmail.com', '993', true);
$imap->search(array('X-GM-THRID', '1424628081834791276');


Here an example for getting the "X-GM-THRID" for a given message with $messageId.

$messageId = 1; // E.g. the message number one
$imap = new Zend_Mail_Protocol_Imap('imap.gmail.com', '993', true);
$message = $imap->requestAndResponse("FETCH $messageId (X-GM-THRID)");
$idHex = (int) $message[0][2][1];
$xGmThrid = base_convert($idHex, 10, 16);

Hope it helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消