Procmail
Table of contents
Install
From FreeBSD portscd /usr/ports/mail/procmail make install
Configure
With Sendmail in FreeBSD (inserted at the end of the FEATURE section in /etc/mail/hostname.mc)FEATURE(local_procmail)
NOTE: If you don't have the file /etc/mail/hostname.mc just run "make all" inside /etc/mail and it will be generated.
Remember to execute this in /etc/mail after saving above change
make all make install
And restart sendmail:
/etc/rc.d/sendmail restart
Hints
Things to put in file /usr/local/etc/procmailrc:VERBOSE=on LOGFILE=/var/log/procmail.log
How to use $MATCH
This variable is assigned to by procmail whenever it is told to extract text from a matching regular expression. It will contain all text matching the regular expression past the "\/" (backslash, slash) token.Example:
:0 f * ^Subject: Something, \/([a-zA-Z_\-]+) | formail -I "Subject: Found $MATCH" :0 f * ^From:.*longass@domain.tld.* | formail -I "From: root@relay.dk"
