On Tue, 2004-07-13 at 09:34, MJ Ray wrote:
On 2004-07-13 07:40:18 +0100 Ian Douglas alug@k1ngph1cher.com wrote:
[tux@alice tux]$ cat ~/.forward "|IFS=' ' && exec /usr/bin/procmail -f || exec 75 tux"
...
not sure why those &&s were there.
In sh those &&'s are okay, they work like commands that can fail. Compare:
mak@yoda$ SHELLOPTS=foo && date bash: SHELLOPTS: readonly variable
mak@yoda$ SHELLOPTS=foo date bash: SHELLOPTS: readonly variable Tue Jul 13 10:54:44 BST 2004
The procmail man page and at least two of the FAQs from the procmail.org use them.
Your "exec 75 tux" should be "exit 75 #tux". That returns the 75 EX_TEMPFAIL exit code to the mta if the procmail invocation fails (say because of syntax error in your .procmailrc), so that your mail doesn't bounce but gets retried later. The "#username" bit is a hideous ancient hack to workaround a sendmail bug.
The "-f" needs an argument, use "-f -". Probably you don't need it at all.
The IFS variable is reset to space because of a very old security bug that I don't remember.
For some example lines:
man procmail (the NOTES section at the bottom) http://rhols66.adsl.netsonic.fi/era/procmail/mini-faq.html#forward http://www.faqs.org/faqs/mail/filtering-faq/section-18.html
Now then, judging by the error message you got, either your mta uses a restricted shell that explicitly disallows the && constructs, or perhaps it parses the whole double-quoted string as a the first argument, where it expects the command.
I'd say try one of these:
|IFS=' ' exec /usr/bin/procmail -f- || exit 75 #tux |/usr/local/bin/procmail
By the way, many modern MTAs can run procmail without a .forward file, by checking whether .procmailrc exists. Exim is definitely one and I'd expect Postfix to be able to do that too. Exim's default debian config does this, I believe. Maybe a Postfix user can tell us how that works?
An MTA doesn't check for ".procmailrc" itself; but you can configure an mta to use procmail as the "local delivery agent". In postfix you can do that with the "mailbox_command" in /etc/postfix/main.cf. In exim you setup a procmail director+transport. If you're going to use procmail for a lot of users on your system, that's probably worth it.
In general, I suggest avoiding procmail unless you have a Compelling Reason. Its configuration is user-hostile line noise and alternatives like maildrop and Exim filter files are easier to write.
After using a custom Perl script based on Mail::Audit for years, I switched to maildrop recently, and that works fairly well for my needs. http://www.flounder.net/~mrsam/maildrop/README.html
My current recipe for a pleasant email life (with admittedly considerable setup time): postfix + spamassassin spamd + amavis + maildrop + courier imap. Stir, simmer, season to taste.
-- Martijn