Skip to main content

How to Upload/Download Email Sieve Filters Set

Many use cases for email filtering are well covered by what Roundcube Web Interface provides. This includes matching by custom headers, copying and redirecting a message, and even auto-replies.

Whitelist/Blacklist should be implemented on the special appliance.

Sieve filters are not the best tool for managing big whitelists and/or blacklists with email addresses or patterns. For this task we propose using E-mail firewall Web Interface ( After logging into it, select Tab “Preferences”, and there in “Whitelist/Blacklist” you can add email addresses and domains to it.

Accessing Sieve Log files.

Web access

Sieve errors are written into the log file, one for each user, named .dovecot.sieve.log. This file is “log-rotated” when it grows too big, producing old log files with names .dovecot.sieve.log.0, .dovecot.sieve.log.1 and so on. First kind of errors is compiler-time errors about syntax problems. In such situation previous version of Sieve script will be used if it exists, or message will be delivered to INBOX as a default action. Another kind of errors is a run-time, for example trying to file a message into not-existing folder. In such case also the default delivery action, filing into INBOX will be taken. To access log files, authenticate with CS.UMD.EDU credentials on your “user home folder” on IMAP Server:$USER with ~USER to be replaced by your CS.UMD.EDU Login name. Directory index is set up to be most recent file .dovecot.sieve.log. Older files can be accessed (if they exist) by explicit filename requests like Previous log file:$USER/.dovecot.log.0, Log file before the previous:$USER/.dovecot.log.1 and so on.

Email requests

Another way to get Sieve Error logs is sending email to <>. This autoreplier send content of the “From:” user sieve log file if it exists and is not empty to the “From:” heder email address, and makes this file empty.

If “From:” header does not point to existing IMAP user or if Sieve log file does not exist or exists but is empty, email to this address is ignored and no reply will be sent.

When Roundcube Web Interface for Sieve is not sufficient.

Our IMAP server has Sieve features which are not available through the Roundcube GUI Web Interface. For example, accessing envelope fields, or editing headers of the message.

Web interface gives user a way to download sieve script to his computer and to upload script after editing it locally.

Managing Sieve Scripts (“Filter Sets”) through Roundcube Web interface.

  • Log into Roundcube Web Interface (
  • Click “Settings” button at the upper right corner
  • Select “Filters” in the left column. You will see the list of “Filter Sets”, that is, Sieve Scripts, in the second column.
  • One of the scripts, if there are a few, should be listed in bold face, and all others should be striked-out.
  • By clicking on any of these scripts they can be selected, which is reflected by darkening the background of the line with it’s name.
  • At the bottom of this column there should be 2 buttons, one with “+” shape to create a new Sieve Script (“Filter Set”). It can be done by creating an empty script, or by duplicating selected on the previous step, or by uploading a file from the computer.
  • Another button with a gear shape - to Enable/Disable selected Filter Set, to Delete it, to Edit it in the browser window, or to Download this filter set to the computer:ManageSieve Filterset Actions.

Examples of Filters supported by our IMAP server

Filtering by the SMTP envelope (not by the Header):

      require ["envelope"];
#rule test-envelope
if envelope :is "from" ""


Adding custom Header to the message

      require ["fileinto","editheader"];
# rule:[test editheader]
if allof (header :contains "Subject" "SPAM", not header :is "To" "")
addheader "Reply-To" "";
redirect :copy "";


Organizing Sieve scripts into small subscripts with ‘# include’

First, create either using web interface or upload a script to be included, for example, named i001:

      require ["enotify"];
# rule:[forward mail from *]
if header :contains "from" ""
        notify :importance "2" :message "mail from Russia arrived" "";


Then upload a calling script:

      require ["include"];
include "001";