DovecotでPOP3・IMAPサーバーを構築
Dovecot(ダヴコット)とは、POP3 / IMAPに対応したメール配送エージェントです。主に、メールソフト(Outlook Express)などを使ってメールにアクセスする為のサーバーソフトです。
Debian 13(trixie)の Dovecot は 2.4.1 です(Debian のパッケージ一覧(madison)・2026年11月5日に確認)。Debian 13 のリリースノートは「trixie の Dovecot は、それより前の版と互換性のない設定形式を使う」と注意していて、記事の 2.x(2.1〜2.3)向けの設定はそのままでは読めません。
| 項目 | この記事(Dovecot 2.1) | Dovecot 2.4(Debian 13) |
|---|---|---|
| 入れるパッケージ | dovecot-common dovecot-pop3d dovecot-imapd | dovecot-core dovecot-pop3d dovecot-imapd(dovecot-common は今の Debian に無い) |
| 設定ファイルの先頭 | 特に無し | dovecot_config_version と dovecot_storage_version が必須 |
| メールボックスの場所 | mail_location = maildir:~/Maildir | mail_driver = maildir と mail_path = ~/Maildir に分かれた |
| 平文の認証 | disable_plaintext_auth = no | auth_allow_cleartext = yes |
| 挨拶の文 | login_greeting | login_greeting(そのまま) |
# /etc/dovecot/conf.d/10-mail.conf
mail_driver = maildir
mail_path = ~/Maildir
設定名の対応は Dovecot 公式の 2.3 から 2.4 への移行ガイド によります。⚠ auth_allow_cleartext = yes は、TLS を使わない接続でもパスワードを受け付ける設定です。外から接続させるなら、TLS(995番・993番)だけを開けてください。
Dovecot(POP3 / IMAP)をインストール
// インストール
# apt-get install dovecot-common dovecot-pop3d dovecot-imapd
※ IMAP を使わないなら、dovecot-imapd は不要です。
設定ファイルの修正(2.x 系、1.x 系)
Dovecotはバージョンによって設定ファイルが異なりますので、インストールしたバージョンを調べてから作業してください。
# dovecot --version
2.1.7
Dovecot 2.x 系
ファイルが分割されているので、変更箇所のみ記載します。
# vi /etc/dovecot/dovecot.confを修正します。
// 挨拶メッセージから Dovecot の文字を隠蔽。
-#login_greeting = Dovecot ready.
+login_greeting = ready.
# vi /etc/dovecot/conf.d/10-mail.confを修正します。
// メールボックを変更
-mail_location = mbox:~/mail:INBOX=/var/mail/%u
+mail_location = maildir:~/Maildir
# vi /etc/dovecot/conf.d/10-auth.confを修正します。
// プレインテキストの認証を許可
-#disable_plaintext_auth = yes
+disable_plaintext_auth = no
Dovecot 1.x 系
# vi /etc/dovecot/dovecot.confを修正します。
-#protocols = imap imaps pop3 pop3s
+protocols = pop3
-#disable_plaintext_auth = yes
+disable_plaintext_auth = no
-#login_greeting = Dovecot ready.
+login_greeting = ready.
-mail_location = mbox:~/mail:INBOX=/var/mail/%u
+mail_location = maildir:~/Maildir
Dovecotを再起動(設定反映)
// 再起動
# /etc/init.d/dovecot restart ← 2013年当時。今は systemctl restart dovecot
Postfixの設定も済んだら、メールソフトで送受信テストを行ってください。
メールが届かない?
Postfix / Dovecot設定は間違っていないけど、メールが届かない場合は、DNS設定にMX指定があるか確認してください。