email Message-ID: What is a good algorithm to create this?

Sheila King sheila at spamcop.net
Tue Apr 3 00:33:31 EDT 2001


First of all, I'd like to thank everyone for their help. (This thread was also
posted to comp.mail.headers and comp.infosystems.www.authoring.cgi.)

On 2 Apr 2001 19:56:03 -0700, aahz at panix.com (Aahz Maruch) wrote in
comp.lang.python in article <9abe43$oj4$1 at panix6.panix.com>:

:In article <ltefctgnte58956letr44ah1n18la9bjor at 4ax.com>,
:Sheila King  <sheila at spamcop.net> wrote:
:>
:>(2) For those without Sendmail access, it is possible to access a SMTP
:>host and send it that way. However, in this case, it seems my script
:>should generate the Message-IDs, as some SMTP servers will fill this in
:>but others will not.
:
:Say what?  I've never seen this.

I had several people ask about this (some in e-mail and some in the
newsgroups). I kid you not. I used the smtplib on my web host and it sent
through messages with no Message-ID. (Why would I want to generate the
Message-IDs if I didn't have to?) Since this appears to happen at least some
times, I figured I'd have to just go ahead and make the message ID, since once
I send the message off, my script is done, and there is no way for me to
retro-actively grab the message back if it didn't get a message-ID and then
stick one on. How common this is...I don't know. My host is using a
proprietary configuration of Qmail. I'm surprised as you all are.

:
:>What is a good way for my script to generate Message-IDs? I know
:>it usually has something to do with random numbers or strings, but
:>I thought I would get some advice on how to do this, first, before
:>blindly proceeding. A description of a general algorithm would be
:>fine. Pointers to online resources describing such are also very
:>welcome.
:
:A Message-ID generally has the form 
:
:    <"random" garbage>[e-mail address]@domain
:
:(That is, some algorithms include the e-mail address and some don't.)
:Probably the simplest solution is to use a combination of random number
:plus time.time() (appended to each other as strings).

All good suggestions. Someone also suggested using the mimetools module
choose_boundary method (from Python). Interesting idea.

I would also like to thank Brett g Porter who posted the following link in
comp.mail.headers:
http://www.jwz.org/doc/mid.html

Besides giving some very nice tips for generating message-IDs, I found some
other really interesting stuff on that site, too. (Like an algorithm for
threading news articles and other assorted stuff.)

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/





More information about the Python-list mailing list