If you subscribe to many mailing lists, it is often useful to deliver each mailing lists to a separate mailbox, so as to keep your main mailbox as free of clutter as possible.
In addition, the fact that you subscribe to one mailing list does not necessarily mean you want to be subscribed to other lists; yet currently it is all too easy for your email address to leak out and be added to other lists without your permission.
The solution to both problems is easy, if you have avenger.local(8) configured on your system. You can simply subscribe to different mailing lists under different addresses, and deliver the different addresses to different mailboxes. To prevent further use of your address by different mailing lists, you can restrict use of list-specific addresses to particular senders.
These examples all assume that you have hooked avenger.local(8) into your MTA, and that your Separator character is +.
test -f "local+lists+$SUFFIX" || reject unknown userNow place the following in $HOME/.avenger/local+lists+email:
! echo "./Mail/.lists.$EXT1"Now you can subscribe to the mailing lists under address yourlogin+lists+email@your.host.com. To create another address, you can link this file to something else (e.g., ln ~/Mail/local+lists+email ~/Mail/local+lists+party).
To restrict to a particular sender, you can create a specific $HOME/.avenger/rcpt+lists+email file, with something like this:
test MALING.LIST.HOST = "$SENDER_HOST" \
|| reject "<$SENDER>.. unauthorized sender"
case "$SPF" in
neutral|none)
spf ESPF mx/24 a/24 ptr -all
setvars
;;
*)
ESPF="$SPF"
;;
esac
case "$ESPF" in
pass)
accept mailing list ok
;;
error)
defer temporary error in DNS processing
;;
*)
reject could not authenticate client \
"$CLIENT_IP" for "$SENDER_HOST"
;;
esac
Fortunately, even if you are subscribed to multiple mailing lists on the same server, it is easy to demultiplex messages based on the sender address. For example, all traffic coming from mailing list list@host.com will generally come from one of three envelope sender addresses:
*-bounces@host.com *-admin@host.com *-owner@host.comNow create the following script in ~/.avenger/scripts/getlist:
#!/bin/sh listdir="$HOME/.avenger/lists" server="${SUFFIX%%+*}" if match -n -1 '*[./]*' "$server"; then echo invalid user elif test ! -f "$listdir/$server"; then echo unknown user elif list=`match -n 1 -f "$listdir/$server" "$SENDER"`; then echo "$server.$list" exit 0 else echo unauthorized sender fi exit 67Make the script executable by running the command chmod +x ~/.avenger/scripts/getlist. Next, create a file ~/.avenger/local+lists+default, with the following line:
! out=`$HOME/.avenger/scripts/getlist` && echo "./Mail/.$out/"Now create a file ~/.avenger/rcpt+lists+default with the following:
if test ! -f "local+lists+$SUFFIX"; then out=`./scripts/getlist` || reject "$out" fi case "$SPF" in neutral|none) spf ESPF mx/24 a/24 ptr -all setvars ;; *) ESPF="$SPF" ;; esac case "$ESPF" in pass) accept mailing list ok ;; error) defer temporary error in DNS processing ;; *) reject could not authenticate client \ "$CLIENT_IP" for "$SENDER_HOST" ;; esacNow you can subscribe to any mailing list on the server under address yourlogin+lists+server@your.host.com.
sentto-NNN-xxx-xxx-user=host@returns.groups.yahoo.comHere, NNN is a number that uniquely identifies the group. You can pull these numbers out of the Return-Path headers of the mail messages, and list them in a directory ~/.avenger/yahoo, so that, for example, the file ~/.avenger/yahoo/3388489 contains a single line with "nyhappenings" (because NNN=3388489 corresponds to the nyhappenings group). Now create a script ~/.avenger/scripts/getyahoo with the following:
#!/bin/sh yahoo="$HOME/.avenger/yahoo" pref=./Mail/.yahoo. if ! groupno=`match -rn1 'sentto-*-*' "$SENDER"` \ || match -n -1 '*[./]*' "$groupno" \ || ! groupname=`cat "${yahoo}/${groupno}"`; then echo "${nnmlpref}unknown/" else echo "${nnmlpref}${groupname}/" fiMake the script executable by running the command chmod +x ~/.avenger/scripts/getyahoo. Next, create a ~/.avenger/local+lists+yahoo file with:
! $HOME/.avenger/scripts/getyahooFinally, create a ~/.avenger/rcpt+lists+yahoo with:
match -n -1 '*[.@]yahoo.com' "@$SENDER_HOST" \ || match -n -1 '*[.@]yahoo-*.com' "@$SENDER_HOST" \ || reject "unauthorized sender" case "$SPF" in neutral|none) spf ESPF ptr:yahoo.com -all setvars ;; *) ESPF="$SPF" ;; esac case "$ESPF" in pass) accept yahoo mailing list ok ;; error) defer temporary error in DNS processing ;; *) reject could not authenticate client "$CLIENT_IP" for "$SENDER_HOST" ;; esacNow you can subscribe to yahoo groups under address yourname+lists+yahoo@your.host.com.