Update mail server filtering with sieve

Getting the filter rules

Steps to update the sieve filter rules.

  • Logon to the server
  • Run sieveshell
> sieveshell --user=selfie mailsurf
  • List the rules currently in place:
> list
  • Export the rule definition to a file:
> get filter_from_list text_file
  • Edit the file (after quitting sieveshell):
$ vi text_file
  • Import the definitions
> put text_file filter_from_list
  • Activate the rules
> activate filter1
  • Quit sieveshell

Now you can try server-side filtering.

Modifying the rules (getting the address books)

To get the address book information to make the filter rules.

  • In Thunderbird, select Tools > Address book
  • Open the address book to export
  • Select Tools > Export
  • Choose Comma Separated from the type menu (lower right) and enter a file name (such as address.csv). Click Save.
  • Close the address book
  • On the server, convert the CSV file to a list of addresses:
awk -F, 'NR > 1 {printf(" \"%s\",\n",$5)}' address.csv | sort > address.txt
  • Use the address.txt file to create the sieve rules.
Tags: