HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Installation/Configuration (
-   -   Spam scan for forwarded mail (

RicochetPeter 16th July 2006 22:28

Spam scan for forwarded mail

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)

till 17th July 2006 13:42

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

RicochetPeter 19th July 2006 21:08

cool, thanks for the hint.

this is my .procmailrc:



## 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/.autoresponder.rc

actually, in none of the included files (here: .mailsize.rc, .spamassassin.rc, .custproc.rc) there's a rule that forwards the mail :confused: ... so, where does the forwarding take place?

the .custproc.rc has all my self-made "put mail from xy to folder xy" rules...

RicochetPeter 19th July 2006 23:13

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?


falko 20th July 2006 14:46

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.

fobicodam 20th July 2006 16:08

:eek: ok... how it would be in english? (or spanish.. je)

falko 21st July 2006 14:37

I don't have such a script at hand right now. You'd have to invent one yourself. ;)

RicochetPeter 21st July 2006 20:56

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:

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):


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

: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.

RicochetPeter 6th February 2008 23:48

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?

falko 7th February 2008 18:52


Originally Posted by RicochetPeter
Just out of interest, was this "mini-howto" of any interest to anyone (besides me)?

Of course! :)

All times are GMT +2. The time now is 12:47.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.