# http://www.natur.cuni.cz/~mmokrejs/procmail/majordomo.rc written by Martin Mokrejs, version 1.0 # # This script is used to automatically respond to BOUNCEd submissions to majordomo # mailing lists. Use this if you have set up, that only members of a certain list # are allowed to post a message. If they aren't, you might as a list-owner receive # copy of a BOUNCEd message. # # This script looks for such BOUNCEs in your incoming mail a replies them. It sends a message # to the original sender (not listname or listname-owener) explaining, that his # message has been rejected because he is not subscribed to the list at all # or he is subscribed from another email address. # # This recipe also takes care of messages BOUNCEd because they exceed maximum allowed # size limit per message, and also of subscribe/unsubscribe requests sent to the list address, # instead of majorodomo@ address or listname-request@ address. # # # LISTNAME = "(montana|horo|foto|kolejni-site)" # put the mail server address which appears on Return-Path: line in mails sent from list MAILSERVER = "@mail\.natur\.cuni\.cz" # # # # # # # Extract sender's email address from the From: line (omit comments and name of the sender, # extract just pure email address) # FROM=`$FORMAIL -zrx To:` # we expect BOUNCEs like: # Subject: BOUNCE montana@mail.natur.cuni.cz: Non-member submission from [someone@anywhere.net] # We extract the email address from the Subject line instead of From: line in returned copy of a message :0 * ^Subject:[ ]*BOUNCE.*[a-zA-Z]@$MAILSERVER:[ ]*Non-member.*submission.*from.*\[\/[^]]+ { SENDER = "$MATCH" LOG = "This is a BOUNCE of message submitted by $SENDER to some majordomo-based email list " :0 H * ^Return-Path: \)From (listserv|owner-) * ^Return-Path: \" | $SENDMAIL -oi -t ) # } # unsubscribe those people who posted their request to the list and the request was fortunately BOUNCEd # :0 * ^Subject:[ ]*BOUNCE $LISTNAME@$MAILSERVER:[ ]*Admin request of type { :0B * ^From:.*\/[^ ].* { SENDER = "$MATCH" } :0f * ^Subject:[ ]*BOUNCE[ ]*\/[^ ] { EXTRACTEDLISTNAME = "$MATCH" } :0B * ^unsubscribe montana[ ]*\/[^ ].* { SENDER = "$MATCH" } :0 fbw | ( echo "unsubscribe $EXTRACTEDLISTNAME $SENDER"; echo "end"; cat - ) :0 b | ( formail -I "Subject:" -I "To: majodomo@natur.cuni.cz" -I "From: $SENDER" | $SENDMAIL -oi -t ) } # subscribe those people who posted their request to the list and the request was fortunately BOUNCEd # :0 * ^Subject:[ ]*BOUNCE $LISTNAME@$MAILSERVER:[ ]*Admin request of type { :0B * ^From:.*\/[^ ].* { SENDER = "$MATCH" } :0f * ^Subject:[ ]*BOUNCE[ ]*\/[^ ] { EXTRACTEDLISTNAME = "$MATCH" } :0B * ^subscribe montana[ ]*\/[^ ].* { SENDER = "$MATCH" } :0 fbw | ( echo "subscribe $EXTRACTEDLISTNAME $SENDER"; echo "end"; cat - ) :0 b | ( formail -I "Subject:" -I "To: majodomo@natur.cuni.cz" -I "From: $SENDER" | $SENDMAIL -oi -t ) }