Questions tagged [sieve-language]

Sieve is a programming language that can be used to create filters for email.

Sieve is a programming language that can be used to create filters for email. It owes its creation to the CMU Cyrus Project, creators of Cyrus IMAP server.

The language is not tied to any particular operating system or mail architecture. The current version of Sieve's base specification is outlined in RFC 5228, published in January 2008.

Sieve differs from traditional programming languages in that it is highly limited – the base standard has no variables, and no loops, preventing runaway programs and limiting the language to simple filtering operations. Although extensions have been devised to extend the language to include variables and, to a limited degree, loops, the language is still highly restricted, and thus unsuitable for running user-devised programs as part of the mail system.

There are also a significant number of restrictions on the grammar of the language, in order to reduce the complexity of parsing the language, but the language also supports the use of multiple methods for comparing localized strings, and is fully Unicode-aware.

The scripts are transferred to the mail server in a server-dependent way. The ManageSieve protocol (defined in RFC 5804) allows users to manage their Sieve scripts on a remote server. Mail servers with local users may allow the scripts to be stored in e.g. a .sieve file in the users' home directories.

41 questions
4
votes
2 answers

Sieve addflag "$label1" does not show in Thunderbird

I am filtering my mails with sieve. I would like to mark certain messages so that they show up in Thunderbird with the corresponding tag. The examples say that require "imap4flags"; followed by an addflag "$label1"; in a statement is supposed to…
Vince42
  • 216
  • 1
  • 10
4
votes
2 answers

How to replace a character by another in a variable

I want to know if there is a way to replace a character by another in a variable. For example replacing every dots with underscores in a string variable.
dblouis
  • 568
  • 1
  • 5
  • 18
4
votes
2 answers

sieve and multiple ACTIVE scripts

Is there a reason the email filter sieve can only activate one single script? > list "mailinglists.sieve" "spam.sieve" ACTIVE > activate mailinglists.sieve > list "mailinglists.sieve" ACTIVE "spam.sieve" > I can't see the logic here ... I…
f00860
  • 3,486
  • 7
  • 41
  • 59
4
votes
2 answers

Test "Received" email header in sieve

Here is an example of how I have configured sieve to forward any mail sent to [nameA|nameB|nameC]@example.org to my private email address. if address :localpart :is ["To","Cc","Bcc"] ["nameA", "nameB", "nameC"] { redirect "
Paul
  • 766
  • 9
  • 28
4
votes
1 answer

sieve mail regular expression not working

I'm using smartsieve web gui to manage my sieve filters. I have a problem with regular expression match. I'm sending myself a test email with subject in format: testXX (where X is a number between 0 and 9). When I define a filter: If message…
Deus777
  • 1,816
  • 1
  • 20
  • 18
3
votes
2 answers

Read sieve conf file in php

I am migrating our mail platform, I have for each user a file (I don't have access to Sieve host) that looks like this require "vacation"; if not header :contains "Precedence" ["bulk","list"] { vacation :days 15 :addresses ["some@email.tld",…
3
votes
1 answer

How to match everything inside the first pair of square brackets

I'm trying to create a regular expression in sieve. The implementation of sieve that I'm using is Dovecot Pigeonhole I'm subscribed to github project updates and I receive emails from github with the subject in the format that looks like this: Re:…
Andrew Savinykh
  • 25,351
  • 17
  • 103
  • 158
2
votes
1 answer

Does sieve's version of regex allow me to look for Cyrillic or CJK characters?

I'm slowly fine-tuning my sieve filter. I noticed I was getting a lot of spam in Russian, so I thought I could filter on the presence of Cyrillic in the subject. I thought maybe three consecutive characters would be a good test, and it seems to work…
2
votes
2 answers

Regex match time from "Received" e-mail header

I am trying to match header to set in a filter on roundcube. I have found another question about this and i tried the answers, but it doesn't work. The regex works when tested in RegExr, but roundcube simply denies to save it. This is my regex:…
Andy
  • 2,892
  • 2
  • 26
  • 33
2
votes
1 answer

Sieve randomly assigns mails to folders

I'm using sieve rules like the following to sort logs from normal mails: require ["fileinto", "envelope", "subaddress", "variables", "mailbox"]; # rule:[asdf-logs] if anyof (address "From" "nagios@mail.com", address "From" "root@mail.com", address…
Hoeze
  • 636
  • 5
  • 20
2
votes
2 answers

Arch Dovecot spamtestplus sieve not working

I followed the guide at https://wiki.archlinux.org/index.php/Dovecot#Sieve In one portion it says to create /var/lib/dovecot/sieve/global_sieves/move_to_spam_folder.sieve with: require "spamtestplus"; require "fileinto"; require…
2
votes
1 answer

Script to automatically create a dovecot.sieve rule for emails in a inbox subdirectory

after browsing/using the solutions on this great site for some time, it is finally time for me to participate. I have a pretty clear concept of what i want, but am searching for the nicest way to get there. What do i want?: For some time now, I use…
DocBrown
  • 21
  • 5
2
votes
0 answers

How to deploy Sieve scripts on Apache James

I have spent two days trying to find a clear instructions on how Sieve scripts are deployed on Apache James. I found some hints that scripts go into "../apps/james/var/" with name such as "username@host.sieve", but doing just that did not work for…
Daniil Shevelev
  • 11,739
  • 12
  • 50
  • 73
1
vote
1 answer

Regex: Match mail address except a specific local part with Sieve (lookaround not supported)

I'm looking for a Regex that matches all addresses of a specific domain "domain.tld", except with a specific local part "fritzbox" (as an example). Unfortunately, the Sieve engine of the mail server I'm using does not support any lookarounds. I've…
myfxp
  • 25
  • 1
  • 8
1
vote
1 answer

Is there a way to set a variable to a list of strings in Sieve?

I want to write a Sieve filter like this: require "fileinto"; require "imap4flags"; require "variables"; set "adresses" ["foo.com", "bar.com", "baz.com"]; if address :domain ["to", "from"] ${addresses} { addflag "\\Seen"; fileinto…
Carlos Marx
  • 496
  • 1
  • 6
  • 13
1
2 3