Skip to content

Mail Filter written incorrectly

From Mail Filter, Add new filter: To Contains some-text Reject some-message. This is saved to .ispconfig-before.sieve as:

### BEGIN FILTER_ID:19
if header :regex    "to" [".*some-text"] {
    reject "some-message";    stop;\n\n}
### END FILTER_ID:19

The \n\n is flagged in /var/log/mail.err as:

Error: sieve: Failed to compile script `/var/vmail/domain.tld/boxname/.ispconfig-before.sieve'

AND THE EMAIL IS LOST. The mail item is not rejected back to the sender.

This fixed code works, verified mail rejected to sender with no error in log:

### BEGIN FILTER_ID:19
if header :regex    "to" [".*some-text"] {
    reject "some-message";
    stop;
}
### END FILTER_ID:19

Running Ubuntu v20 with ISPConfig v3.2.1.