Robert Chien <[EMAIL PROTECTED]> wrote:
> I have two general mail questions:
> 
> 1. can it be guaranteed that _EVERY_ email has a message-id?

Every message is _supposed_ to have a unique message id by the time it leaves
its first SMTP relay -- incoming SMTP traffic is supposed to be scanned
for message IDs, and if necessary, one is added.  This is necessary because a
lot of dumb clients don't generate them.

> 2. if not, can you generate a message-id?
> 
> Background: I'd like to write a perl script whose input is a
> mail folder, and the script looks at each individual email's
> message-id and do something with it (if it sees a duplicate,
> then ignore the duplicate, etc). If it doesn't find one,
> what should be done?

You can generate an ID for them.  But you shouldn't really use message ID to
detect duplicates, although its a common practice.  Message IDs are supposed
to be unique, but sometimes aren't.  If you want to do it properly, generate
a cryptographic hash of the message (either the whole thing, or just
the body) with md5 or something, and compare those.

For a good quick reference on message ids, see:
http://cr.yp.to/immhf/thread.html

Charles
-- 
----------------------------------------------------
Charles Cazabon          <[EMAIL PROTECTED]>
Any opinions expressed are just that -- my opinions.
----------------------------------------------------

Reply via email to