コンテンツにスキップ

IMAPサーバ

概要

次の表のとおりである。

項目
IMAPサーバ Dovecot

設定

$ sudo apt install dovecot-imapd
  • /etc/dovecot/conf.d/10-master.conf
service imap-login {
  inet_listener imap {
    #port = 143
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }

service auth {

  # Postfix smtp-auth
  unix_listener /var/spool/postfix/private/auth {
    mode = 0666
  }
  • /etc/dovecot/conf.d/10-mail.conf
mail_driver = maildir
mail_home = /home/%{user | username}
mail_path = %{home}/Maildir
  • /etc/dovecot/conf.d/10-ssl.conf
ssl_server_cert_file = /etc/letsencrypt/live/mail.medeshima.com/fullchain.pem
ssl_server_key_file = /etc/letsencrypt/live/mail.medeshima.com/privkey.pem

メールフィルタ

$ sudo apt install dovecot-sieve
  • /etc/postfix/main.cf
mailbox_command = /usr/lib/dovecot/deliver -f "$SENDER" -a "$RECIPIENT"
$ sudo systemctl reload postfix@-
  • /etc/dovecot/conf.d/15-lda.conf
protocol lda {
  # Boolean list of plugins to load
  mail_plugins {
     sieve = yes
  }
}

ユーザ設定

require "fileinto";

if address :is "From" "logwatch@example.com"
{
  fileinto "logwatch";
}
ln -s sieve/dovecot.sieve .dovecot.sieve

dovecot-managesieved