I finally got it working. Maybe it would have been easier to use maildrop (as
Peter Green reported that he got it working with vmailmgr), but I really don't
care, as long as I've got a working server-side filtering system.
Please feel free to comment. Could I have avoided creating
/var/spool/mail/[VMAILDOMAIN_USER] file somehow?
QMAIL+VMAILMGR+PROCMAIL+SAFECAT MINI-HOWTO
------------------------------------------
- Connect to your mail server as root with ssh.
- First check that you have all the programs installed.
- I use the following expressions in this document:
[VMAILDOMAIN_USER] = the user's name in who's home directory the virtual
domain is
installed
[VUSER] = the name of the virtual mail user
For example in my mail server configuration these would be:
[VMAILDOMAIN_USER] = vdomain1
[VUSER] = peter:peltonen
- I found out that if file /var/spool/mail/[VMAILDOMAIN_USER] didn't exist,
procmail
wouldn't work. So check that it exists. If it doesn't, create it and give it
proper ownership:
root# touch /var/spool/mail/[VMAILDOMAIN_USER]
root# chown [VMAILDOMAIN_USER]:mail /var/spool/mail/[VMAILDOMAIN_USER]
First time procmail is used it gives the file proper permissions.
- Create the user's .procmailrc:
root# su - [VMAILDOMAIN_USER] -c "touch
/home/[VMAILDOMAIN_USER]/users/[VUSER]/.procmailrc"
- Make the filtering rules to that file. You can see my example .procmailrc at
the
end of this document. Great advice can be also found at:
http://www.ii.com/internet/robots/procmail/qs/#recipes
- Enable procmail-filtering by editing /home/[VMAILDOMAIN_USER]/.qmail-[VUSER]
file
and replacing the line
--snip--
|/usr/bin/vdeliver
--snip--
to
--snip--
| preline /usr/bin/procmail /home/kotelo/users/peter/.procmailrc
--snip--
NOTE: If you don't have a /home/[VMAILDOMAIN_USER]/.qmail-[VUSER] file,
create it
and put the procmail line in it.
- That's it!
MY EXAMPLE .PROCMAILRC
----------------------
--snip--
#
# tell procmail where to find my maildir
#
MAILDIR="/home/vdomain1/users/peter:peltonen"
#
# the filtering rules
#
# to courier-list
:0
* ^[EMAIL PROTECTED]
{
:0
| /usr/bin/maildir $MAILDIR/.courier-list
}
# put the rest of my mail to my Inbox
:0
{
:0
| /usr/bin/maildir $MAILDIR/
}
--snip--
Regards,
Peter