Question

I 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?

Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top