IMAP Message UID

Published on Christian Mayer's Weblog

[This post was originally posted as a Stackoverflow question.]

In RFC3501 there is 2.3.1.1. Unique Identifier (UID) section: A 32-bit value assigned to each message, which when used with the unique identifier validity value (see below) forms a 64-bit value that MUST NOT refer to any other message in the mailbox or any subsequent mailbox with the same name forever.

Most tools like Zend\Mail in PHP use the microtime, process id and uname to generate an UID for an email. So I get something like 1400603156.789.5617.imac.home,S=129:2,S. This is not conform with RFC3501. Zend Mail can handle Maildir format so I don’t care about managing email files on the harddisk. But if I can’t handle Zend Mail’s UID for RFC conform transmission I need a separate database where I have an allocation.

So I still need to manage the UIDs in a separate place. Or is there another solution?

Update, 2014-05-21 12:02: Solution

Max wrote:

Yes, generally an IMAP server keeps a database of UIDs separate and maps them to say, Maildir files. They are not intrinsic to the email themselves, they are added by the server for client convenience.

More Resources

Recent Posts

About the Author

Christian is a professional software developer living in Vienna, Austria. He loves coffee and is strongly addicted to music. In his spare time he writes open source software. He is known for developing automatic data processing systems on Debian Linux server.

Categories: Programming
Tags: PHP, Email, Mail, Zend, Framework, IMAP, RFC

Archive | Categories | RSS Feed | Usage | Imprint
Copyright © 2006 by