procmail
[Top] [All Lists]

Re: Scoring Recipe for repeating addresses?

2002-06-19 20:20:03
At 18:15 2002-06-19 -0700, procmail(_at_)deliberate(_dot_)net did say:

        In other words, just set it up to change SENDMAIL for
!bang use and direct logs and mail delivery to another area (and

When you invoke the MTA to deliver a message - say through a chain of pipes (using formail and typically cat or echo, often for autoreplies or notifications), you should also use $SENDMAIL, rather than specifying the MTA program by name. This is the proper thing to do, and by doing so, it is conveniently handled by the redefined $SENDMAIL (which in my sandbox, points to a simple shell script to dump the message and arguments to a file, where you can verify that it would have run as you expected).

* $ ^(To|Cc):.*\/[-+\._a-z0-9]*@([-a-z0-9]+\.)*$DOMAINLIST

minour bit, but the ([-a-z0-9]+\.)* really probably should be:

        ([-_a-z0-9]+\.)*

(note addition of underscore). You should use the trailing asterisk only if you really expect multiple levels of optional hostnames on your domain - otherwise a '?' in place of the asterisk is appropriate (0 or 1, versus 0 or more).


[snip - header extraction, excluding leading space]

would I not be better off in this case using this form instead of
the simpler form you suggested in your example earlier in this
thread:
        * ^To:\/.*

The example of extracting the To: and Cc: headers was intended to simply extract the contents for the purpose of checking their content, not for the potential re-use of the content for any other purpose. In the case of the common header extraction I perform in my sandbox (and in my .procmailrc), I may opt to re-use the header (say if I were rewriting the subject), and I'd just as soon not have the extra leading spaces at that time - since the extraction overhead is minimal, I choose to eliminate the leading space at that time.

        Also, if in another recipe I reversed the logic in your
test for non-blank KEYADDR (you suggested):
        * ! KEYADDR ?? ^^^^

wouldn't that give me a positive flag that there are no proper
email addresses in the To/Cc headers for any of my domains?

Yes - which means the filter didn't pluck a reference address for "hey, they're emailing yourname and yourname(_at_)otherdomains". You'll note that the added generic "webmaster | postmaster" recipe which I offered to be appended to the other recipes operated only if the KEYADDR wasn't ALREADY webmaster or postmaster (although, the handling actually isn't consistent there - if the message was addressed to you as postmaster or webmaster at your domain, the initial recipe would score hits only on other webmaster OR postmasters (based on whichever the first addressee at your domain was), then skip the generic check - which might have tripped if the first check wasn't (say) postmaster, since there might have been two postmasters and three webmasters addressed - which would trip the second rule.

I wrote it off the hip in response to your query, so there's obviously some points for improvement.

As I have for years gone thru the struggle of only delivering based on
proper To/Cc headers (and all that entails, I know, I know,
mailing lists etc etc), wouldn't that allow me to reject the
message right then? (And to heck with the Bcc senders)

If you want to reject messages which are not Cleartext addressed to you, I'd advise that you do so from a separate recipe which acts upon that and only that - say after filtering known mailing lists.

Repeat the procmail mantra: Procmail is not an MTA. I hope you're not redelivering messages to other accounts based on the cleartext recipients of the messages, because you'll always run into trouble with doing that.

---
 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>