views:

39

answers:

1

Hi,

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?

+1  A: 

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

Avel