PHP IMAP - Should emails have messageid?

I get emails from Gmail using PHP and IMAP; however, some emails do not have messageid. Not all messages must have messageid?

I need a unique identifier for the link, so I'm not sure how else to track emails without it.

Am I doing something wrong?

For example, here is the email header I receive

[date] => Sun, 06 Nov 2011 21:21:56 -0500 [subject] => Daylight Saving Time? Chili Saving Time! [to] => -------@gmail.com [message_id] => [from] => ChilisCorp@---.com [sender] => ChilisCorp@----.com [reply_toaddress] => ChilisCorpeclubsupport@---.com [size] => 14385 [msgno] => 156 [status] => Unread 

thanks

+7
source share
2 answers

Any MTA I've ever come across will add a Message-ID if it is not already present. However, if you need to track messages or use them, you need to set a Message-ID . The References header and In-Reply-To header use the value of the previous Message-ID to bind messages together.

References contains a list of previous Message-ID values ​​in the response chain, and In-Reply-To contains a Message-ID to which the current message is a direct response.

Please note that according to RFC-2822 specification, a message identifier is not technically required . Well-written MTAs usually include one, but some commentators below describe cases where the message identifier was missing, which causes messaging clients to fail.

+5
source

The message identifier has nothing to do with IMAP, but is part of the mail itself and is specified in RFC 2822 as "optional" (although it says that it should be present):

Although optional, each message MUST have a "Message-ID:" field.

So, you are not doing anything wrong if some mailboxes do not have a Message-ID. This happens for all emails that the MUA that originally sent the mail did not generate it (which, however, should be performed by every commonly used MUA).

As for the unique identifier for identifying letters through IMAP, you can look in the UID field described in the standard .

+5
source

All Articles