Write a Sieve (language) filter to search an body and header of a message for a list of strings

0

I have the following rule in sieve to filter out messages containing various words in foreign languages:

if body :raw :contains [
  "choix",
  "comprovante",
  ...                                # various words elided
  "soldes",
  "visualizar esta mensagem"
 ]
{
  fileinto "ForeignSpam";
}

This checks only the body of the message, but I want to check both the headers and the body. I could write a similar rule that applies only to headers, but then I'd have to repeat the list of strings.

How can I write a single rule that searches an entire message (the body plus all headers) for any of a list of words?

KnowItAllWannabe

Posted 2017-07-03T04:47:16.270

Reputation: 598

1Without even knowing what platform you're writing it for I'd assume magic. – Seth – 2017-07-03T07:02:23.577

1Sieve is standardized. Why would the answer be platform-specific? – KnowItAllWannabe – 2017-07-03T15:14:55.490

1

Because your wording doesn't make obvious that you're talking about Sieve (mail filtering language) and not just talking about an algorithm using Sieve theory.

– Seth – 2017-07-04T05:55:47.743

1

As for what you can do, look into RFC 5229: Variables Extension and RFC 6609: Include Extension, both from the official (?) overview.

– Seth – 2017-07-04T06:01:46.273

No answers