procmail
[Top] [All Lists]

Re: handling cross-posters

2001-12-01 13:30:03
At 14:23 2001-12-01 +0000, Stephen Patterson wrote:

Where does the message id get added to a message?

It may be added by the originating mail client (preferrably), their mail server, your mail server, formail, or not at all.

If it gets set by your mail server (on receipt) or by formail (within your rules, not by the sender), the messageid will differ from say, the identical message which may have been copied to you at another account someplace (perhaps even on the local host, but at a different domain handled by it).

Sendmail can add/rewrite headers (other MTAs should be able to as well, but I'm not familiar with their configurations). On the various delivery methods ("Mlocal", "Mprog", etc), there are flags which control whether certain transormation are executed or not. In my case, Mlocal and Mprog both contain "M", which means that my servers will add the Message-ID header during local delivery if it isn't found, even though it _really_ should be set at the sending client and/or their mailserver.

formail can be used to generate a Message-ID:

        formail -a "Message-ID:"
        (see 'man formail')

Mail servers _should_ add it because it _should_ be there, and if they sending server is configured to add a Message-ID, if you receive multiple copies, they should all have the same Message-ID.

For message ID cache, locally using formail to add the header won't do you any good. Likewise, if your mail server is adding it to the messages as they are received, you won't get the desired result either (this isn't to say that you should _remove_ the option from sendmail -- having the Message-ID is better than not having it, and Sendmail isn't regenerating the header if it already exists). The sending mail server might add it, and that's a bit better, but if the sending mail client is multiply invoking that server to send the message (say it hiccups and mails out the message several times), those messages will arrive with different Message-IDs. Thus, the best place for the Message-ID to be set for it to truely uniquely identify a message, is at the originating mail client, preferrably when the message is first passed to that client's outbox.

If you're running sendmail or a reasonable clone (postfix for example):

        sendmail -t < somerawmessage

where the raw message contains just from:, subject:, and to: (you) headers. Address it so that you receive the message unprocessed by procmail (say via an Mprog invoked alias), and then you'll be assured that procmail (as LDA) - or some recipe that you're executing with it - doesn't alter the message (which isn't a concern if you know how procmail works, but for the sake of this example, if you know it isn't being invoked, it's a safe bet it isn't affecting your message). A sendmail alias to help you with that might look like so:

testuseronce:   "|cat - >> /tmp/testmessagefile"

(which isn't a safe way to concatenate into a regular file, but seeing as you should be using this test user for *ONE* test message, this won't hurt).

Send the message and examine the resultant file and note the headers which were added. The message was sent without the aid of a mail client, so the mail client has been removed from the equation, and was locally delivered (via Mprog) without the aid of procmail, so you know it didn't affect the message.

        diff somerawmessage /tmp/testmessagefile

What has been added?

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>