Hello, Below is the description of a preprocessor script I wrote for mailman. I was looking to emulate the Topica.com features of "<list>-subscribe", "<list>-unsubscribe" and "<list>-post-<password>" in an efficient and extensible manner.
I am seeking feedback on the script and I have two areas that are troubling right now: *) I still get a succesful completion AND an error message back from mailman when sending to "<list>-unsubscribe" (yet I don't get one when sending to "<list>-unsubscribe" which *should* process exactly the same way. I know I coiuld re-write the entire message - but I am wondering if there is a way to make unsubscribe work the same way as subscribe and post - by doing replacements to the inbound message. *) I am wondering if there is a way to alter all the messages sent out by mailman to match my configuration. There are some in "Templates" - but others seem hardcoded. Right now I am tied to Mailman 2.0.13 due to needing to stay compliant with the RedHat 2.1AS distribution.
The script can be found at http://desktopengineer.com/mmpreproc
Thanks for any time anyone can take to send feedback, D.
# This script pre-processes mail commands to mailman to faciliate announcement lists and easy subscribe and unsubscribe. # It modifies the list behavior as follows: # *) unsubscribes only made through the alias <list>-firstname.lastname@example.org and automatically sets users password to their email # *) unsubscribes only made through the alias <list>-email@example.com and automatically unsubscribes with no confirm, email=password is assumed # *) posting to the list can only be done through a special alias that includes a password component such as <list>-post-<password>@domain.com. # The list can be configured for moderation and only allow a specific list of emails to be automatically approved. Since it is recommended # that you delete the <list>@domain.com alias, using this method prevents the need to moderate messages that try to use the standard posting # alias - even if you do not allow auto approval of posts to specific email addresses. # *) This script accomplishes its objectives by having the mail message piped to it and then it pipes the message into the standard mailman wrapper for # processing. This is more efficient than re-mailing back to the same system. In addition, since the program simply does regex substitutions to # inbound message headers, the posting password alias can work easily with complex messages that include mime sections because the entire message does not # need to pass through mail again and therefore be disassembled, reassembled and then emailed correctly. # *) Many other modifications could be made for preprocessing mailman commands and posts - the script design is modular and dynamic - it pulls apart the # mail aliases components (seperate by "-" character) and decides what to do with the message based on these components.
# Install # *) Tested with mailman 2.0.13 (Redhat 2.1AS Version) # *) Ensure you have Mail:Mailer (mailtools) installed if you wish to have error notification or debug emails sent, or rewrite the email section # to suite your system. # *) Copy mmprepoc.pl to <mailmanroot>/mail (e.g. "cp mmpreproc.pl /path/to/mailman/mail") # *) Change ownership to the mailman user (e.g. "chown mailman mmpreproc.pl") # *) Change security to be executable (e.g. "chmod 755 mmpreproc.pl") # *) For sendmail create a link in the /etc/smrsh directory (e.g. "ln -s /path/to/mailman/mail/mmpreproc.pl") # *) Set $mailmanpath - this should be the directory with all your mailman subdirectories (including "bin") in it. # *) Set $blockrequests - if set to "1" this script blocks all <list>-firstname.lastname@example.org messages except replys to # subscription confirmations. # *) Set $emaildiscards, $emailerrors, $emaildebug and $emailnotifyaddress if you wish to use email notification.
# Configure Mailman (note your lists cannot have a "-" character in their name): # *) add the list alias <listname>-subscribe: "|/path/to/mailman/mail/mmpreproc.pl" # *) add the list alias <listname>-unsubscribe: "|/path/to/mailman/mail/mmpreproc.pl"
# Configure Mailman: If using the post-password alias feature # *) add the list alias <listname>-post-<password>: "|/path/to/mailman/mail/subprocessor" # *) remove the list alias <list> or send it to null so that you don't have to moderate messages sent there. # *) in mail man set posting to the list to be only allowed from members of the list and setup any auto-approval email # addresses. It won't matter that users can see your auto approved email when receiving messages because they cannot # tell that you used a special alias to send the message rather than <list>@domain.com