Procmail Mailing List (procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE)
wrote:
Okay, I know this is not _really_ about procmail but the people here would
be the main ones to know.
What is a good mail reader with _thread_ support (as in replies show up
right after the original message) similar to tin.
I am currently attached to (far too) many maillists, and really
couldn't have managed without a proper solution to this.
My solution is to route mail groups into local newsgroups.
That way, threading, expiring and archiving can be set up
as you desire. In my .procmailrc, I have stuff like:
:0 w
* ^TOprocmail(_at_)informatik
| mnews mail.procmail
Notice the mnews. You cannot use either inews or rnews for news
insertion, mainly because typical mailgroup headers are pretty bad.
Much worse than on usenet. So I made my own news inserter, mnews.
It tries to be tolerant against header errors, but more work can
still be put into it.
This setup is made for Cnews, but I assume it will not need much
change for INN.
To be 110% sure none of this gets out of your spool, remember to
include a "!mail" together with e.g. "!junk" in the "sys" file.
One way to send local postings to the list is to declare
the list as moderated:
addgroup mail.procmail m
One then sets up the correct moderator address in "mailpaths":
mail.procmail procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE
This is simple, but will split the header, making the appearance
of the message a bit odd.
The best method is to set up direct mail forwarding in the "sys"
file:
procmail/mail:mail.procmail/all:nL:sendmail procmail(_at_)\
Informatik.RWTH-Aachen.DE
One problem with this is that there is a non-Posix "feature" in Cnews
that doesn't work with standard bash. I have a fix for that, but
haven't gotten around to test it yet.
The third method (which I use now) is to use an outgoing spool:
mail.procmail/mail:mail.procmail/all:FL:
I then have to put this line in a news crontab script:
batch.viamail mail.procmail
procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE
Egil
----file: mnews ----------------------------------------------------
#! /bin/sh
#
# make mail message suitable for injecting
# into the newssystem
# argument: newsgroup
# returns: error if posting failed, so procmail will know,
# and put it into incoming mail instead
#
# BUG: rewrite with formail?
# BUG: duplicates should be silently ignored...
# BUG: does not handle cross-posting..
# BUG: what about unparsable Date: `Thu, 4 Jan 21:10:02 1996'
# BUG: what about Message-IDs with blanks in them
#
if [ "$1" = "" ]; then
echo "Usage:" $0 "groupname article"
exit 1
fi
tmp1=/tmp/mnews1.$$
tmp2=/tmp/mnews2.$$
if [ "$2" = "" ]; then
# standard input
in=-
else
in=$2
fi
# handle empty subject
cat $in | sed "s/^Subject: *$/Subject: None/" >$tmp2
# these headers are always required
echo Newsgroups: $1 >$tmp1
echo Path: mail!via-mail >>$tmp1
# BUG: this is in no way bullet proof...
if ! grep -i -q "^Subject:" $tmp2; then
# no Subject line, we must insert one
echo Subject: None >>$tmp1
fi
if ! grep -i -q "^Message-ID:" $tmp2; then
# a Message-ID is missing
# the message-ID depends on file contents only
# so there is some hope we will reject duplicates
echo Message-ID: \<`cksum <$tmp2 | sed "sX *[0-9]*XX"`(_at_)mail\> >>$tmp1
fi
# X-out offensive headers in original
cat $tmp2 | sed "1s/From /X-From: /" |
sed "1s/Newsgroups: /X-Newsgroups: /" >>$tmp1
# insert news, making rejection a serious matter
if ! /usr/lib/newsbin/relay/relaynews -s <$tmp1; then
rm -f $tmp1
rm -f $tmp2
exit 1
fi
rm -f $tmp1
rm -f $tmp2
exit 0
--------------------------------------------------------------------
----file:batch.viamail ---------------------------------------------
#!/bin/sh
#
# batch out one newsgroup via mail
#
# arguments:
# 1 newsgroup name
# 2 mailing address
#
NEWSSPOOL=/var/spool/news
if [ -z $1 ] ; then
echo $1 "name of outgoing batch required"
exit 1
fi
if [ -z $2 ] ; then
echo "mailing address required"
exit 1
fi
if ! [ -d $NEWSSPOOL/out.going/$1 ] ; then
echo $1 "is not an outgoing batch"
exit 1
fi
#BUG: no locking...
if [ -s $NEWSSPOOL/out.going/$1/togo ] ; then
echo -n >$NEWSSPOOL/out.going/$1/togo.tmp
(
while read article; do
if ! [ -s $NEWSSPOOL/$article ] ; then
echo article $article missing
else
#debug:
echo mailing $article in $1
if ! sendmail $2 <$NEWSSPOOL/$article ; then
echo $article >>$NEWSSPOOL/out.going/$1/togo.tmp
echo article $article failed
fi
fi
done
) <$NEWSSPOOL/out.going/$1/togo
mv $NEWSSPOOL/out.going/$1/togo $NEWSSPOOL/out.going/$1/togo.o
mv $NEWSSPOOL/out.going/$1/togo.tmp $NEWSSPOOL/out.going/$1/togo
fi
exit 0
--------------------------------------------------------------------
--
Email: egilk(_at_)sn(_dot_)no Voice: +47 2252 3641, 920 22780 Fax: +47 2252
5899
Snail: Egil Kvaleberg, Husebybakken 14A, 0379 Oslo, Norway
URL: http://www.sn.no/~egilk/