My problem is to merge several existing mailing lists into one distributed
mailing list.
People can subscribe to any node, and receive all postings to any node. I wish
to achieve this by a procmail script that precedes the existing mailing list
operations. Additionally, one of the lists has a subject header tag that
shouldn't
be propagated.
Please suggest any improvements to the proposed solution below.
thanks,
Ralph
---
MYDOMAIN=${MYDOMAIN-`hostname`}
LIST=test-list
NODES="test-list(_at_)node1(_dot_)com, test-list(_at_)node2(_dot_)com,
test-list(_at_)node3(_dot_)com"
#drop duplicates
:0 Wh: dup.lock
| formail -D 8192 dup.cache
#archiving. turned off by default. Take out the "!" line to activate.
:0
* !
| gzip -fcq9 >> arch`date +%y%d`.gz
# get the date in RFC822 format for insertion into some messages;
# the "Resent-Date:" field is copied from the "Date:" field on some systems.
# RFC1123 says "All mail software SHOULD use 4-digit years in dates..."
DATE=`date '+%a, %d %h %Y %H:%M:%S %Z'`
# Distribute to other Nodes
# assume use of "formail" since that makes things a lot easier
# apparently sendmail ignores "To:" in the presence of "Resent-To:"
:0 c
| formail -b \
-IResent-From: -I "From " \
-i"Resent-To: $NODES" \
-i"Resent-Date: $DATE" \
-i"Errors-To: $LIST-errors(_at_)$MYDOMAIN" \
-a"To: $NODES" \
| $SENDMAIL -t -oi "$NODES"
:0
* ^Subject:.*( HEADER )
{
NEWSUBJECT="-iSubject: "`formail -xSubject: | sed -e 's/HEADER *//; s/Re:
Re:/Re:/; '`
}
# optionally set up Errors-To, Sender and X-Node headers if mailing list
software doesn't
# do that. turned off by default. Take out the "!" line to activate.
:0 Wfhi
*!
| formail -i"Errors-To: $LIST-errors(_at_)$MYDOMAIN" \
-i"Sender: owner-$LIST(_at_)$MYDOMAIN" \
-i"X-Node: $MYDOMAIN" \
${NEWSUBJECT+"$NEWSUBJECT"}
#place code here to send to existing list