how to retrieve a specific message from imap with consistent id (message id)
开发者_如何学JAVAI need to keep a link tracking for an email message. I am using PHP and IMAP. I need some ID that identify the email over time. Using IMAP UID does not seems to work since the UID changes after expunge(), i know there is a message_id for emails, but how can i retrieve an email using it's message_id with PHP and IMAP?
Is there another identifier i can use?
You need UIDPLUS IMAP extension, specifically the UIDVALIDITY command. See RFC 4315.
Many PHP webmail projects actually use this already. I suggest you take a look at Squirrelmail's source code if you need examples and/or inspiration. (Squirrelmail has an excellent IMAP backend; other webmail projects or classes might also work but I personally don't know if they use UIDPLUS).
精彩评论