0

I have a Centos 7 server setup with Postfix, Spamassassin and procmail. It works fine, it receives and sends email , it passes it to the spam filter and delivers it to the required user or external email address.

The problem is, if I have a procmail recipe that processes mail, and then forwards it to an external address, this does not happen. On my previous Centos 6 server (with sendmail) this worked fine. The type of procmail recipe I am using is:

:0H
* ^X-Spam-Score:        * (\*\*\*\*\*\*\*\*\*\*
/dev/null


:0H
* ^X-Spam-Score:        * (\*\*\*\*\
$HOME/mail/Spam

:0
[email protected]

Any ideas?

1 Answer 1

0

You have syntax errors in both regexes. You cannot have an opening parenthesis without a closing parenthesis, and you cannot have your regex end with a backslash. (Or rather, the destination folder becomes part of your regex, but then you cannot have a recipe without a destination folder or other action.)

The parentheses seem superfluous here anyway; I guess you want

:0H
* ^X-Spam-Score:[     ]*\*\*\*\*\*\*\*\*\*\*
/dev/null

:0H
* ^X-Spam-Score:[     ]*\*\*\*\*\*
$HOME/mail/Spam

where the two occurrences of [ ]* should have a space and a tab between the square brackets to match arbitrary whitespace before the literal asterisks; and the first recipe matches ten literal asterisks, anl the second, five. (Add more if you wanted more, or take away some if vice versa.)

For troubleshooting Procmail, defining a LOGFILE and examining the diagnostics in it is usually a good first step. There's a troubleshooting page at http://www.iki.fi/era/mail/procmail-debug.html with more guidance and other things you can try.

8
  • Then opening parenthesis is a literal character in the regex string. This recipe has been working correctly for 5 years or more. Are you suggesting I should escape the opening bracket? Thanks, Jim
    – JIm Rolt
    Commented Sep 23, 2018 at 8:24
  • Yes, you need \( to match a literal opening parenthesis. And again, define LOGFILE so you can see and react to any error messages from Procmail.
    – tripleee
    Commented Sep 23, 2018 at 9:39
  • Thanks for the tip! I tried it this and it's made no difference to either the spam filtering(which was, and is, fine) or the forwarding of procmail filtered emails as a forward. I sense this is a problem of procmail failing to pick up the email again after filtering; procmail is configured to use port 2525 and send via mailgun as this is a google cloud server with port 25 unavailable... any further ideas will be very welcome!
    – JIm Rolt
    Commented Sep 26, 2018 at 17:40
  • Procmail doesn't use a port number; I guess you mean Postfix is? If you are not currently managing to get Postfix to run Procmail when an incoming message arrives, that's a completely different question, where we need to see your Postfix configuration.
    – tripleee
    Commented Sep 27, 2018 at 4:32
  • Or do you mean Procmail runs but sendmail in the forwarding action fails? Same thing though, we need to troubleshoot your sendmail (which is probably in your case a wrapper from the Postfix package).
    – tripleee
    Commented Sep 27, 2018 at 4:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .