我正在为我的个人域设置电子邮件服务器。只会有一个用户(我)。我在 Arch 上运行 DigitalOcean VPS,截至昨天一切都是最新的。
我已经安装并运行了 postfix:当您向我的新地址发送电子邮件时,它会存储在/var/spool/mail/richard
.
我的问题是鸽舍。以下是我通过以下方式与其互动的记录telnet
:
$ telnet microbug.uk imap
Trying 46.101.26.207...
Connected to microbug.uk.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.
a1 login richard [password]
a1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SPECIAL-USE] Logged in
a2 list "" "*"
* LIST () "." INBOX
a2 NO [SERVERBUG] Internal error occurred. Refer to server log for more information. [2015-06-16 20:58:30] (0.002 secs).
systemctl status dovecot
揭示了 dovecot 希望/var/spool/mail/richard
成为一个目录(?!):
$ systemctl status dovecot
* dovecot.service - Dovecot IMAP/POP3 email server
Loaded: loaded (/usr/lib/systemd/system/dovecot.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2015-06-16 19:23:18 UTC; 1h 40min ago
Main PID: 739 (dovecot)
CGroup: /system.slice/dovecot.service
|- 739 /usr/bin/dovecot -F
|- 740 dovecot/anvil
|-1396 dovecot/log
`-1423 dovecot/imap
Jun 16 20:47:20 server dovecot[1360]: imap-login: Login: user=<richard>, method=PLAIN, rip=86.6.26.155, lip=46.101.26.207, mpid=1365, session=<ezk7rqgYLQBWBhqb>
Jun 16 20:50:41 server dovecot[739]: master: Warning: SIGHUP received - reloading configuration
Jun 16 20:50:41 server dovecot[1360]: imap(richard): Server shutting down. in=52 out=1059
Jun 16 20:50:49 server dovecot[1396]: imap-login: Login: user=<richard>, method=PLAIN, rip=86.6.26.155, lip=46.101.26.207, mpid=1401, session=<0kquuqgYWwBWBhqb>
Jun 16 20:53:31 server dovecot[1396]: imap(richard): Error: opendir(/var/spool/mail/richard) failed: Not a directory
Jun 16 20:53:31 server dovecot[1396]: imap(richard): Error: opendir(/var/spool/mail/richard) failed: Not a directory
Jun 16 20:58:04 server dovecot[1396]: imap(richard): Connection closed in=87 out=1077
Jun 16 20:58:23 server dovecot[1396]: imap-login: Login: user=<richard>, method=PLAIN, rip=86.6.26.155, lip=46.101.26.207, mpid=1423, session=<K2y+1agY/QBWBhqb>
Jun 16 20:58:30 server dovecot[1396]: imap(richard): Error: opendir(/var/spool/mail/richard) failed: Not a directory
Jun 16 20:58:30 server dovecot[1396]: imap(richard): Error: opendir(/var/spool/mail/richard) failed: Not a directory
建立/var/spool/mail/richard
一个目录可以阻止 dovecot 抱怨...但是 postfix 无法发送邮件。
postconf -n
(后缀设置与默认值不同):
alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
command_directory = /usr/bin
compatibility_level = 2
daemon_directory = /usr/lib/postfix/bin
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_protocols = ipv4
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
meta_directory = /etc/postfix
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
myhostname = microbug.uk
mynetworks_style = host
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
notify_classes = bounce, data, delay, policy, protocol, resource, software
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix
sample_directory = /etc/postfix
sendmail_path = /usr/bin/sendmail
setgid_group = postdrop
shlib_directory = /usr/lib/postfix
unknown_local_recipient_reject_code = 550
doveconf -n
(鸽舍设置与默认值不同):
# 2.2.18: /etc/dovecot/dovecot.conf
# OS: Linux 4.0.5-1-ARCH x86_64 ext4
disable_plaintext_auth = no
mail_location = maildir:/var/spool/mail/%u
mail_temp_dir = /
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
args = scheme=CRYPT username_format=%u /etc/dovecot/users
driver = passwd-file
}
protocols = imap
ssl = no
userdb {
args = username_format=%u /etc/dovecot/users
driver = passwd-file
}
任何帮助将不胜感激!我可以根据需要发布额外的配置。
编辑:添加配置文件
(我知道这个配置不安全,但当它工作时我会添加 SSL)
答案1
Postfix 正在传递到邮箱文件而不是 Maildir。
在 Dovecot 中尝试这样的事情:
mail_location = mbox:~/mail:INBOX=/var/mail/%u
或者,使用如下命令配置 postfix 以传送到 Maildir:
sudo postconf -e "home_mailbox = Maildir/"
并通过指定以下内容将 Dovecot 配置为使用 Maildir:
mail_location = maildir:~/Maildir
如果您想混合使用 Maildir 格式的文件夹和 mbox 格式的收件箱,请查看 Dovecot 文档。