IMAP Envelope email address format?

2.6k views Asked by At

If I poll an IMAP server for an Envelope structure SELECT INBOX, FETCH UID ALL - I will get an envelope structure in return.

For all fields in the envelope structure that are an email address, from, sender, reply-to, etc, I have noticed this is how an email address is represented:

(("Name on Email Account" NIL "emailaddress" "domain.com"))

or for accounts with no email name set -

((NIL NIL "emailaddressnoname" "domain.com"))

I can see the 1st value is the name, the 3rd value is the email address name & the 4th value is the domain name - but what is the 2nd value for? I've polled for hundreds of emails from many different IMAP servers and this value is always NIL & I'm afraid that one day it's not going to be NIL and it's going to mess up my parsing code.

In the part of the RFC that defines Envelope structure (https://www.rfc-editor.org/rfc/rfc822) nothing is mentioned about this.

Anybody know what's going on?

1

There are 1 answers

1
Max On

From RFC 3501, section 7.4.2 (Fetch Responses), subsection ENVELOPE:

An address structure is a parenthesized list that describes an
electronic mail address.  The fields of an address structure
are in the following order: personal name, [SMTP]
at-domain-list (source route), mailbox name, and host name.

The second portion represents source routes, which are obsolete on the Internet, so can be effectively ignored.

There is also information about group list syntax, which is also nearly obsolete, but you may come across it occasionally.