procmail
[Top] [All Lists]

reply-to logic - list bounces

2001-11-10 18:17:08

I'm helping an associate, who runs many majordomo lists. We'll be invoking procmail via a pipe where the majordomo alias is normally invoked so we can bounce problem submissions (attachments, overquoted material, etc) back to the sender.

For those interested, that's done with a sendmail alias like so:

listname: "|/usr/local/bin/procmail -m /etc/procmailrcs/majordomo.rc \"original delivery alias which was piped to and it's arguments\""

The default delivery for the rule then is like so:

:0
|$1

which makes inserting procmail in front of the original delivery to majordomo pretty painless, and allows one procmail rc file to act for all the lists (though, different ones could be used). Another possibility is to pass an additional argument, which expands as $2 in procmail, which would say, identify the explicit listname, so procmail could do list-specific operations (even INCLUDERC=/etc/procmailrcs/lists/$2, I should expect).

While it isn't the primary focus of this post, how would one go about doing an "include this file, but only if it exists" ? Or does one merely include it and live with the error that is generated if it isn't present?

Now, to my real question. In performing these bounces, I'm thinking I should be using 'formail -rzxTo:' to obtain the sender address, rather than including the reply-to address (which they might have set to the list, much as I do here, or might simply go to an address they normally want to recieve replies at), since a regular maildaemon bounce should go to the sender not to a reply-to, or even the From:, I figure a list submission bounce should go there as well. Any compelling reason this shouldn't hold true?

Before sending the autoreply, we'd check to make sure the address isn't within the domain where the lists are (or use a complete regexp to match it against the known lists). Can anyone think of why this wouldn't be the way to do it?


# used in regexp, so DOUBLE escape special chars
# could be a regexp complete with different list names
OURDOMAIN=@(subdomain\\.|)domain\\.tld

:0h
REPLYTO=|formail -rzxTo:


# X-Loop is actually checked for and handled prior to this rule (it
# generates an alert to a sysadm), but we include it here just to
# ensure that if that other rule is disabled that we don't get into an
# autoreply loop here as a result.

# The B line should have the trigger text.  \Escape slashes and dots.
# as given here, it isn't anchored to the beginning of the line (to
# account for quote indent).  This match WILL NOT survive a linebreak.
:0
* ! ^X-Loop:[   ]+looper(_at_)domain
* ! ^FROM_DAEMON
* B ?? \/\/ list policy dictates that messages be trimmed
{
        # If the reply address isn't something to avoid, then
        # bounce the submission to it.
        * $! REPLYTO ?? $OURDOMAIN
        :0
        | (cat $AUTOREPLY/bloat.msg - | \
                formail -I "Subject: your submission was rejected" \
                -I "To: $REPLYTO" \
                -I "X-Loop: looper(_at_)domain(_dot_)tld" \
                -I "From: listbot(_at_)domain(_dot_)tld")| $SENDMAIL -t

        # Execution will fall here only if preceeding wasn't run
        # (due to issue with reply address)
        # encapsulate the entire original message (headers and all) into
        # the body of a new message, with an alert subject.
        :0f
        | cat $AUTOREPLY/loopalert.msg - | \
                formail -I "Subject: Loop ALERT" \
                -I "From: listbot(_at_)domain(_dot_)tld"

        # forward the modified message to the loop-alert admin
        :0
        ! loop-alert(_at_)domain(_dot_)tld
}

# daemon messages are expected to be internally bounced to the admin
# by the majordomo software.  If not, an additional rule will be put
# into place which handles that condition.

---
 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>
  • reply-to logic - list bounces, Professional Software Engineering <=