Dovecot 是目前大部分 Linux 內定的 POP3/IMAP Server,其特點為高度安全性與設定簡易;不論是小型郵件系統或是大型郵件伺服器都適合使用。 在 Debian 中安裝好後僅需簡單設定即可使用。
安裝

以下安裝指令會安裝 POP3 與 IMAP 兩種協定。

$ sudo aptitude install dovecot-common dovecot-imapd dovecot-pop3d

設定

dovecot 設定檔為 /etc/dovecot/dovecot.conf

# 設定支援哪些協定,在此為 IMAP 與 POP3 兩個
# Protocols we want to be serving: imap imaps pop3 pop3s
# If you only want to use dovecot-auth, you can set this to "none".
#protocols = imap imaps
protocols = imap pop3

# 設定監聽的 ip 與 port,可個別指定 imap 與 pop3 的監聽介面
# If you want to specify ports for each service, you will need to configure
# these settings inside the protocol imap/pop3 { ... } section, so you can
# specify different ports for IMAP/POP3. For example:
#   protocol imap {
#     listen = *:10143
#     ssl_listen = *:10943
#     ..
#   }
#   protocol pop3 {
#     listen = *:10100
#     ..
#   }
listen = *

# 設定啟動認證 
# Disable LOGIN command and all other plaintext authentications unless
# SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP
# matches the local IP (ie. you're connecting from the same computer), the
# connection is considered secure and plaintext authentication is allowed.
disable_plaintext_auth = no

# 認證機制
# Space separated list of wanted authentication mechanisms:
#   plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi
# NOTE: See also disable_plaintext_auth setting.
mechanisms = plain login

mbox vs maildir

mbox 格式將每個資料夾視為一個檔案,該資料夾內的所有信件都存放於該單一檔案中。 maildir 與 mbox 格式不同處為 maildir 將每封 mail 視為一個檔案並儲存,理論上當 mail 數量大到一定程度後,其存取速度、損毀機會都遠較 mbox 來的好。

Dovecot 預設為 mbox 信件儲存格式,若要更改為 maildir 須於設定檔修改如下:

# See /usr/share/doc/dovecot-common/wiki/Variables.txt for full list. Some
# examples:
#
#   mail_location = maildir:~/Maildir
#   mail_location = mbox:~/mail:INBOX=/var/mail/%u
#   mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
#
# <doc/wiki/MailLocation.txt>
#
mail_location = maildir:~/Maildir

MTA 部份也必須跟著設定,最後重新起動即可;dovecot 會在接受到信件時自動建立對應的目錄。
 
arrow
arrow
    全站熱搜

    neio 發表在 痞客邦 留言(0) 人氣()