Hi, got another question: What would I have to do to let forwarded mail be scanned for spam? (With the standard setup, when a mail account is set to be forwarded to one or more external mail addresses, the mails aren't scanned for spam, only the ones that are to be put into a local mail box)
You will have to change the order of included procmail recipes in the file .procmailrc in the home directory of the mail user so the spam scanning script is in front of the redirection script. If you want to change it globally for new users, you will have to modify the template file /root/ispconfig/isp/conf/procmailrc.master
cool, thanks for the hint. this is my .procmailrc: Code: MAILDIR=$HOME/Maildir/ DEFAULT=$MAILDIR ORGMAIL=$MAILDIR INCLUDERC=/var/www/web10/user/web10_peter/.mailsize.rc ## INCLUDERC=/var/www/web10/user/web10_peter/.quota.rc ## INCLUDERC=/var/www/web10/user/web10_peter/.antivirus.rc ## INCLUDERC=/var/www/web10/user/web10_peter/.local-rules.rc ## INCLUDERC=/var/www/web10/user/web10_peter/.html-trap.rc INCLUDERC=/var/www/web10/user/web10_peter/.spamassassin.rc ## INCLUDERC=/var/www/web10/user/web10_peter/.autoresponder.rc INCLUDERC=/var/www/web10/user/web10_peter/.custproc.rc actually, in none of the included files (here: .mailsize.rc, .spamassassin.rc, .custproc.rc) there's a rule that forwards the mail ... so, where does the forwarding take place? the .custproc.rc has all my self-made "put mail from xy to folder xy" rules...
Ah, found it. It's the .forward file in the user's directory. Which process reads it and how do I make it come after the procmailrc? I seem to understand that postfix gives incoming mail to "objects" in the .forward file, which is a comma separated list. So the forwarded mail is totally independant of the mail which will be spam scanned and delivered to a mailbox? Ideas?
You'd have to rewrite the forwarding mechanism so that it uses a procmail recipe instead of the .forward file. In the .forward file you would invoke procmail which then reads the procmail recipes.
OK, here's the howto: 1) Modify /root/ispconfig/isp/conf/procmailrc.master to include a "per-user-procmail" file by adding this line to the end: Code: INCLUDERC={PMDIR}/.custproc.rc You do not have to use ".custproc.rc", chose any file name you like. This will make procmail include every user's custom recipe file. 2) Delete the forward in the ISPConfig web interface 3) Add the following to the user's ".custproc.rc" (or whatever name you chose): Code: :0 ! [email protected] Done. Like this you can provide accounts that are forwarded, but also spam scanned. Another option: if you want to keep a local copy in the user's mailbox, make the first line in the .custproc.rc Code: :0 c The only difference is the "c" after the 0, which make procmail deliver a copy to the remote address, not the mail itself.
Just out of interest, was this "mini-howto" of any interest to anyone (besides me)? Or is there even a better way to do it?