Dennis Hammer <dhammer(_at_)tks(_dot_)fh-sbg(_dot_)ac(_dot_)at> writes:
i have a mail account at my isp with 4 aliases and i get this stuff with
fetchmail. then everything is in my /var/spool/mail/root - box. then I
start procmail with the ORIGMAIL - var set to /var/spool/mail/root. As a
rule I have something like * ^To.*kh, kh being one of my aliases. well,
procmail simply does _nothing_ - it just seems to wait for STDIN and I got
no clue how to fix that. Is there something obvious that I just don't see?
Procmail is expecting to be fed an email message to process on stdin.
As it's designed to be called at mail delivery time, calling it later
requires some work. This wouldn't be a problem if your mail system was
setup correctly. Two things you should check are:
a) Fetchmail should be handing off the mail it fetches to sendmail
or whatever MTA you use. If it just puts the mail in your
mailbox then you need to get a newer version of fetchmail.
b) sendmail should be configured to use procmail as the local
mailer. If you have sendmail V8 then you can just use the m4
config file generators scripts to do this by including the
local_procmail FEATURE().
Instead of messing with sendmail, it is probably a lot easier to just
configure your POP client program to output directly to stdout, then
pipe that to procmail, via formail -s.
Here is the shell script I use to do this. I am using popclient, the
predecessor to fetchmail, but any POP client that can be configured to
output to stdout will work (with popclient, this is -c or --stdout).
Note that I have procmail configured to output all of my filtered
(non-spam) email to a single folder (~/Mail/inbox), then I cat this to my
usual system-wide mailbox. If you only want procmail to filter your
incoming email and leave it in place, you can remove everything except the
'popclient' line.
#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin
MAILBOX=/var/mail/thieleke
FILTERED=$HOME/Mail/inbox
if lockfile -1 -r10 -l900 -ml
then
popclient -v -a -c -p `cat PASSWORDFILE` -u USERNAME POPSERVER | formail -s
procmail
test -s $FILTERED && cat $FILTERED >> $MAILBOX && rm -f $FILTERED
lockfile -mu
fi
exit 0
Jeff Thieleke