procmail
[Top] [All Lists]

Re: [Procmail??] Apparently-To: Headers

1997-01-06 23:57:01
Philip Guenther writes:

Not quite.  An Apparently-To: header is inserted iff there are no
recipient headers at all, including To:, Cc:, Bcc:, and the Resent-
forms of all three of those.  Furthermore, as of sendmail 8.7, the
default is to not insert an Apparently-To: header, but rather to leave
the message bare of recipient headers, though this is configurable via
the "NoRecipientAction" option.


It was a fragment, because that is what he ask. A more complete
rendition is:

    #
    # If there is no "^To:" record in the message, then the message is,
    # almost certainly, junk mail. Note that this probably interacts with
    # the next recipe, since messages that do not have a "^To:" will have
    # an "Apparently-To:" record inserted by sendmail(1).
    #
    :0:
    * !^To:.*
    junk
    #
    # Finally, if not specifically addressed to at least this machine, the
    # message is to be considered junk mail. This will correctly file
    # messages that are .forward'ed from other accounts, bang addresses,
    # etc. Note that the "* !^TOmymachine" will correctly read header records
    # of the form "Resent-To:.*mymachine" and not file the message in "junk"
    # if resent to an address that contains at least this machine name. The
    # "^TO" will match "Original-To:", "Original-Cc:", "Original-Bcc:",
    # "To:", "Cc:", "Bcc:", "Xenvelope-To:", "Apparently-To",
    # "Apparently-Resent-To:", "Resent-To:", "Resent-Cc:", and
    # "Resent-Bcc:".
    #
    :0:
    * !^TOmymachine
    junk

This, of course, depends on sendmail's "NoRecipientAction" not putting
a domain or machine name in the "Apparently-To:" field-the idea being
that an MTA's bounce command to you should not file stuff in junk. A
"To:", with nothing else in the field, will be filed in junk.

If you get a lot of junk, (which contains "To: (addressed list
suppressed)" or something of the like, then the first recipe might be
"!^To:.*mymachine", etc.  Prior to these, you might want to fgrep your
~/.mailrc to see if the mail is from someone you know with something
like:

    SENDER=`formail -rtzx To:`
    #
    # Then test for the existence of a ${HOME}/.mailrc file, and if it
    # exists, then search ~/.mailrc for the return address-if found, file
    # the message in the user's home mailbox.
    #
    :0 h
    * ? test -f ${HOME}/.mailrc
    * ? fgrep -i -s -e "${SENDER}" ${HOME}/.mailrc
    {
        :0:
        my_known_friends
    }

which can be reversed if you have a reject list, containing folks or
domain names that you never want to hear from, by filing it in
/dev/null.

        John

-- 

John Conover, 631 Lamont Ct., Campbell, CA., 95008, USA.
VOX 408.370.2688, FAX 408.379.9602
john(_at_)johncon(_dot_)com