Koozali.org: home of the SME Server

Procmail Rules assistance

Offline paul_NZ

  • ****
  • 79
  • +0/-0
    • http://www.csssnz.com
Procmail Rules assistance
« on: July 01, 2004, 09:01:22 AM »
I run SME 5.6 with Spam Assassin and Procmail.

I have user setup under server manager to deliver locally AND forward to another local user.

This works okay EXCEPT when you activate Procmail and therefore Spam Assassin under the user manager.

It would appear that the Prcomail rule under Normal mode overrights the forward that I have setup as spam is checked ok but the forward does not take place.

Remove the forward, activate Procmail and therefore Spam Assassin and spam is check but of course not the forward.

Deactivate Procmail, establish the foward and the forward works but not Spam checking.

There must be a way to add a rule in the Procmail rules that delivers locally AND forwards AND checks for Spam ... but how? and what specifically needs to be added? and I also guess where exactly?

Any help appreciated.

Thanks

Offline raem

  • *
  • 3,972
  • +4/-0
Procmail Rules assistance
« Reply #1 on: July 01, 2004, 11:56:22 AM »
The behaviour you are seeing is correct & I experienced the same thing. As I understand it Procmail only works on local delivery to the end user account, so cannot intervene if you wish to forward mail as well.

You would be much better off (and more secure too) if you upgrade to v6.0 or 6,0.1 (not 6beta3), and use the installed spamassassin that filters at the qmail queue level rather than end user level. There are also server manager panel contribs to configure spamassassin. Under this arrangement you do not use Procmail.

An alternative would be to ditch spamassassin altogether (as it is very processor intensive) and use my howto to block a lot of spam using RBL's (you need v6.0 at least to use this feature). Also see the virus blocking using patterm matching howto as well.

http://mirror.contribs.org/smeserver/contribs/rmitchell/smeserver/howto/Spam%20blocking%20HOWTO%20using%20smtpfront-qmail%20for%20sme%20server.htm

http://mirror.contribs.org/smeserver/contribs/rmitchell/smeserver/howto/Virus%20and%20file%20blocking%20HOWTO%20using%20smtpfront-qmail%20for%20sme%20server.htm
...

Offline paul_NZ

  • ****
  • 79
  • +0/-0
    • http://www.csssnz.com
Procmail
« Reply #2 on: July 01, 2004, 10:15:52 PM »
Quote from: "RayMitchell"


http://mirror.contribs.org/smeserver/contribs/rmitchell/smeserver/howto/Spam%20blocking%20HOWTO%20using%20smtpfront-qmail%20for%20sme%20server.htm

http://mirror.contribs.org/smeserver/contribs/rmitchell/smeserver/howto/Virus%20and%20file%20blocking%20HOWTO%20using%20smtpfront-qmail%20for%20sme%20server.htm


Thanks Ray but as I'm with 5.6 I had to find another way ... I did and I detail below:

In Server Manager and User Manager leave delivery as local.

In User Manager go to Process Mail and set you first rule -
- based on: recipient email address
- criterion: user account name
- action: forward email
- destination: email address where you wish to have it forwarded
- copy: yes
- action: send to inbox

Thats it.

Offline raem

  • *
  • 3,972
  • +4/-0
Procmail Rules assistance
« Reply #3 on: July 02, 2004, 07:59:34 AM »
Is that going to work for ALL messages or just the spam filtered messages ?
...

Offline paul_NZ

  • ****
  • 79
  • +0/-0
    • http://www.csssnz.com
Procmail Rules assistance
« Reply #4 on: July 02, 2004, 09:29:01 AM »
Ray

For this user, all messages are forwarded and delivered locally.

Seems to be working as I hoped for and no other user is affected.

Offline sgt-spam

  • ****
  • 84
  • +0/-0
Procmail Rules assistance
« Reply #5 on: August 22, 2004, 02:52:57 PM »
I've been using your setup to test some things, and it seems that procmail is fairly precise.

When you specify the username as the first criterion, ONLY that username appears to be forwarded.  Pseudonym's are NOT forwarded from what I can see.  Nor are messages coming into the mailbox that would have been forwarded from other accounts.

Example: I forward messages to my cell phone from the SME, and I forward messages to the SME from other accounts (like Yahoo).  If I configure a forwarding rule as you've mentioned above, only email sent directly to the SME account makes it to my cell phone - not the messages from other accounts that are forwarded.  My solution was to simply add rules for the other accounts.

My only comment is this: Just make sure if you're going to forward using procmail that you know where the messages are coming from (other account they were sent to and will be forwarded from), as you may not get everything forwarded that you want.

SteveB

Re: Procmail Rules assistance
« Reply #6 on: August 23, 2004, 05:45:07 PM »
Quote from: "paul_NZ"

There must be a way to add a rule in the Procmail rules that delivers locally AND forwards AND checks for Spam ...


I needed to do the same thing on my system, I use WINSCP to browse to /home/e-smith/files/users/***** where ***** is the user you wish to modify.In this folder you will find a .procmailrc file, edit this file using your preferred text editor, I use the one in WINSCP but avoid using Notepad in Windows as it can cause problems.

At the end of the file after all the processing recipes, you will see

# --------------------------
# all else goes to the inbox
# --------------------------
:0
$DEFAULT

Just before this insert the following recipe

# --------------------------
# all else copied to remote
# --------------------------
:0c
! user@domain.com

This will copy anything that has passed through your previous recipes (and would be delevered to your inbox) to be copied to the email address in the ! line.

There is an incredible amount you can do with procmail, for example you can set up rules to forward mail only if its from a specific email address:

# -------------------------------------------------------------------------
# All mail from root@domain.com is diverted to remote@home.net
# -------------------------------------------------------------------------
:0
* ^From:.*root@domain.com
! remote@home.net

You can add as many recipes as you need, but run tests after each change until you are confident with procmail.

The :0 line in simple terms means that if the message meets the condition it will process the last line in that recipe and be finished with. Adding a c to make :0c in simple terms processes the recipe and then moves a 'copy' to the next recipe. The * line is a condition line, if the condition is met then the following line is processed, if the condition is not met, then procmail moves on to the next recipe.

Hope this helps, Regards, Steve.

Note * = asterix