Archive

Posts Tagged ‘dovecot’

Сортировка почты с помощью Dovecot Sieve

March 5th, 2009 No comments

Что имеется: postfix + mysql + dovecot как imap сервер + roundcube
Задача: сделать так, что бы письма с пометкой SPAM ложились в каталог Junk, а не Inbox.

Собираем Dovecot с поддержкой LDA:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@case.net.ru]$ cd /usr/ports/mail/dovecot
[root@case.net.ru]$ make showconfig
===> The following configuration options are available for dovecot-1.1.11:
     KQUEUE=on "kqueue(2) support"
     SSL=off "SSL support"
     IPV6=off "IPv6 support"
     POP3=off "POP3 support"
     LDA=on "LDA support"
     MANAGESIEVE=off "ManageSieve support"
     GSSAPI=off "GSSAPI support"
     VPOPMAIL=off "VPopMail support"
     BDB=off "BerkleyDB support"
     LDAP=off "OpenLDAP support"
     PGSQL=off "PostgreSQL support"
     MYSQL=on "MySQL support"
     SQLITE=off "SQLite support"
===> Use 'make config' to modify these settings
[root@case.net.ru]$ make install clean

Устанавливаем dovecot-sieve:

1
2
[root@case.net.ru]$ cd /usr/ports/mail/dovecot-sieve/
[root@case.net.ru]$ make install clean

Настраиваем postfix:
Добавляем в master.cf:

1
2
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/deliver -f ${sender} -d ${recipient}

Меняем в main.cf:

1
virtual_transport = dovecot

Меняем в dovecot.conf:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
protocol lda {
  postmaster_address = case@case.net.ru
  hostname = case.net.ru
  mail_plugins = cmusieve
  mail_plugin_dir = /usr/local/lib/dovecot/lda
  sendmail_path = /usr/sbin/sendmail
  sieve_global_path = /usr/home/vmail/dovecot-sieve.conf
}
 
auth default {
  socket listen {
    master {
      path = /var/run/dovecot/auth-master
      mode = 0600
      user = vmail
      group = vmail
    }
  }
}

Настраиваем sieve в файле /usr/home/vmail/dovecot-sieve.conf:

1
2
3
4
require "fileinto";
if header :contains "Subject" "SPAM" {
  fileinto "Junk";
}

Личный почтовый ящик

September 28th, 2008 No comments

postfix (smtpd) + dovecot (imapd) + roundcube webmail (web interface for imapd) + spamassassin

dovecot.conf (только изменения)

protocols = imap
listen = 127.0.0.1
disable_plaintext_auth = no
ssl_disable = yes
mail_location = maildir:/usr/home/vmail/%u
auth default {
mechanisms = plain
passdb sql {
args = /usr/local/etc/dovecot-sql.conf
}
userdb static {
args = uid=2011 gid=2011 home=/usr/home/vmail/%u
}
user = vmail
}

spamassassin: /usr/local/etc/mail/spamassassin/local.cf

rewrite_header Subject *****SPAM*****
report_safe 0
required_score 10.0
use_bayes 1
bayes_auto_learn 1