| |
Miscellaneous: Procmail(last edit: 2000-11-22)
NOTE: this document only covers basic procmail configuration. If you would like to get
the most out of procmail I suggest you start reading 'man procmail' and all man pages to
which 'man procmail' refers.
How to configure procmail?
First of all install it via /usr/ports/mail/procmail (duh?)
You'll have to make an '.procmailrc' and a '.forward' file in your homedir.
.forward
This file must contain at least the following line (with the quotes):
"|exec /usr/local/bin/procmail"
You can ofcourse add e-mail adresses and/or other programs to this file but that's
a forware thing (see 'man forward') and beond the scope of this document.
This line forwards all the mail to procmail which starts, read your ~/.procmailrc
file and processes the mail to the according mailboxes and stops.
.procmailrc
Here's an example to start:
---
:0:
* ^TOBUGTRAQ
mail/Bugtraq
:0:
* ^TOspam
mail/spam
---
The first set of rules will place all mail send to 'BUGTRAQ' in the 'Bugtraq' mail box.
The ^TO matches destination specifications like 'To', 'Cc' etc.
Furthermore you can specify a "^From.*[name]" and a "^Subject:.*[text]". e.g.:
:0:
* ^From.*myself
* ^Subject:.*test
mail/test
This should place all e-mails from 'mysef@domain.com/net/whaterver' in the 'test' mailbox.
This is how my .procmailrc file looks like (yeah I know it's a _REALY_ simple one):
---
:0:
* ^TOBUGTRAQ
mail/Bugtraq
:0:
* ^From.*jappe
* ^Subject:.*test
mail/test
---
Now you should be able to setup a simple procmail.rc file.
bogus mailbox
This is something one of my collegues figured out so the credits for this
go to him!!!:
If you're getting complaints from procmail about being unable to rename
the bogus mailbox /var/mail/usercode or whatever, you may want to read
on.
Problem - from procmail(1) doc:
-----------------------------< cut here >-------------------------------
If /var/mail/$LOGNAME is a bogus mailbox (i.e. does not
belong to the recipient, is unwritable, is a symbolic link
or is a hard link), procmail will upon startup try to re-
name it into a file starting with `BOGUS.$LOGNAME.' and
ending in an inode-sequence-code. If this turns out to be
impossible, ORGMAIL will have no initial value, and hence
will inhibit delivery without a proper rcfile.
-----------------------------< cut here >-------------------------------
If /var/mail/usercode is a symlink pointing to e.g. /home/usercode/.mail then
this triggers it. You can't change it in ~/.procmailrc because this happens
before that is read.
Solution:
become root
# cd /usr/ports/mail/procmail
# make patch
# cd work/procmail*/src
# vi authenticate.c
[ or preferred editor ]
find the line defining MAILSPOOLHOME and remove the leading ``/*''
save, exit
# cd ../../..
# make
# pkg_info | fgrep procmail
# pkg_delete procmail-whichever_version
# make install
# make clean
That should solve it.
See also the XBuffy how-to.
Click here to go back to the index.
|