[Rspamd-Users] Rewrite subject + Add X-Spam header at once

Szőts Ákos szotsaki at gmail.com
Fri Jun 20 07:31:36 UTC 2025


Hi all,

I'd like execute two actions on an e-mail that contains virus or phishing:

1. Rewrite its subject to start with *** VIRUS *** or *** PHISHING ***
2. Add X-Spam header so the Sieve script picks it up along with the rest of
the spams

Force_actions seems not to be useful:

rules {
  VIRUS_SUBJECT {
    action = "rewrite subject";
    expression = "CLAM_VIRUS | JUST_EICAR";
    subject = "*** VIRUS *** %s";
  }

  VIRUS_SPAM {
    action = "add header";
    expression = "CLAM_VIRUS | JUST_EICAR";
  }
}

It does rewrite the subject but doesn't add the header. Toying with
honor_action adds the header but not the rewrite.

In milter_headers tried

use = ["x-virus"];
routines {
  x-virus {
    header = "X-Virus";
    remove = 0;
    symbols = ["CLAM_VIRUS", "JUST_EICAR"];
  }
}

But it doesn't work at all. Probably force_action has a precedence?
Moreover, it's not extendable to phishing.

There's a still open question about it in
https://github.com/rspamd/rspamd/issues/3078, too.

Do you know how can I both add an X-Spam (or other custom) header *and*
modify the subject at once?

Thank you,

Ákos


More information about the Users mailing list