Debian Squeeze Server Side Mail Filtering

Written by Ryan Egeland, 15 July 2011.

These instructions are collected from various sources and are used for the following collection of configurations:

  1. Google acts as MX server for domain, collecting all mail and making it accessible to IMAP polling by
  2. Fetchmail on the server, which passes all mail to
  3. Exim4 MTA, which passes mail off to
  4. Dovecot LDA, which filters using
  5. Sieve scripts in ~/.dovecot.script, created using
  6. Managesieve accessed by
  7. Roundcube mail filter plugin

Exim

Add the following to /etc/exim4/exim4.conf.template in the transports section. This makes exim pass incoming mails from
#####################################################
### transport/30_exim4-config_dovecot_delivery
### ADDED BY RDE FOR DOVECOT LDA
#####################################################

dovecot_delivery:
  driver = pipe
  command = /usr/lib/dovecot/deliver
  #message_prefix =
  #message_suffix =
  log_output
  delivery_date_add
  envelope_to_add
  return_path_add
  #group = mail
  #mode = 0660
  temp_errors = 64 : 69 : 70: 71 : 72 : 73 : 74 : 75 : 78

#####################################################
### end transport/30_exim4-config_dovecot_delivery

Dovecot

Modify /etc/dovecot/dovecot.conf to enable the local delivery agent and with that, enable sieve:
protocol lda {
   postmaster_address = postmaster@egeland.net
   mail_plugins = sieve
}
Enable the location of the sieve script files (used by the roundcube defaults).
plugin {
  sieve=~/.dovecot.sieve
  sieve_dir=~/sieve
} 

Roundcube

The sieverules plugin works through managesieve (part of dovecot) to create and modify server side filters. The default managesieve ports do not need to be modified in /var/lib/roundcube/plugins/sieverules/config.inc.php or /etc/dovecot/dovecot.conf but this may change in future Debian versions since IANA has assigned port 4190 to managesieve.

Notes

Sieve rules are stored in ~/.dovecot.sieve, which is actually a symbolic link to ~/sieve/roundcube.sieve. The latter file is modified when using the sieverules plugin.
Topic revision: r1 - 15 Jul 2011 - 20:10:48 - RyanEgeland
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.