clarkk
clarkk

Reputation: 27689

IMAP - difference between msgno and uid?

What is the difference between msgno and uid? It looks like they always are the same even if msgs are deleted!?

Upvotes: 3

Views: 4463

Answers (2)

Maypeur
Maypeur

Reputation: 396

In my case, uid is always the same as msgno and message_id

The worst it's that when i delete messages on the mail server, msgno and UID are reattributed in the order of arrival.

I have make a little script which fetch mails with imap_search and imap_overview to get headers, i use imap_uid($this->GetConnection(),$msgno); to force get the UID from the MSGNO and here the result :

echo "MSGNO : $msgno UID : $overview->uid UIDBYNO : ". $mbox->GetUidByNum($msgno)."
";

MSGNO : 851 UID : 851 UIDBYNO : 851 MSGNO : 852 UID : 852 UIDBYNO : 852 MSGNO : 853 UID : 853 UIDBYNO : 853 MSGNO : 854 UID : 854 UIDBYNO : 854 MSGNO : 855 UID : 855 UIDBYNO : 855 MSGNO : 856 UID : 856 UIDBYNO : 856 MSGNO : 857 UID : 857 UIDBYNO : 857

So 1) uid isn't unique 2) msgno is always the same as uid

Maybe the mailserver doesn't respect the RFC !

Upvotes: 1

mobius
mobius

Reputation: 5174

As it says on http://www.php.net/manual/en/function.imap-uid.php:

This function returns the UID for the given message sequence number. An UID is a unique identifier that will not change over time while a message sequence number may change whenever the content of the mailbox changes.

Upvotes: 3

Related Questions