我已经从一个服务器提供商转移到另一个服务器提供商,并移植了我所有的域名和服务。一切看起来都很顺利,但现在我意识到我在 dovecot/postfix 方面遇到了一些问题。
第一个问题:在 Web 界面(Roundcube)中,我看到所有旧邮件都带有正确的时间戳,当在邮件客户端上获取它们时,我总是看到 2015 年 5 月 5 日(服务器移动后的一天)作为日期。
第二个问题:我似乎无法通过 IMAP 发送和接收邮件。我没有收到错误(我将在本文后面发布日志),好像邮件已经发送了。
第三个问题:日志文件充斥着此错误:warning: 9C42A2408E2: virtual_alias_maps map lookup problem for root@dirty-harry -- message not accepted, try again later
(dirty-harry 是我的服务器名称!)。
我已经在 Google 上搜索了所有这些问题,再次查看了我的配置,但找不到任何可以解决我的问题的东西。
配置如下:
主配置文件
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/postfix/sslcert/mailserver.crt
smtpd_tls_key_file=/etc/postfix/sslcert/mailserver.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = dirty-harry
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = static.136.90.47.78.clients.your-server.de, dirty-harry, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
disable_vrfy_command = yes
smtpd_sasl_type=dovecot
smtpd_sasl_path=private/auth_dovecot
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
broken_sasl_auth_clients = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql_sender_login_maps.cf
smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch
reject_unknown_sender_domain
smtpd_recipient_restrictions = permit_sasl_authenticated
permit_mynetworks
reject_unauth_destination
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_base = /var/vmail/
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 112400000
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 104
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
主配置文件
smtp inet n - - - - smtpd
smtps inet n - - - - smtpd
-o smtpd_tls_wrappermode=yes
#628 inet n - - - - qmqpd
pickup unix n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
relay unix - - - - - smtp
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
dovecot配置文件
protocols = imap imaps pop3 pop3s
log_timestamp = "%Y-%m-%d %H:%M:%S "
ssl_cert_file = /etc/postfix/sslcert/mailserver.crt
ssl_key_file = /etc/postfix/sslcert/mailserver.key
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
}
protocol lda {
postmaster_address = [email protected]
auth_socket_path = /var/run/dovecot/auth-master
}
auth default {
mechanisms = plain login
passdb sql {
args = /etc/dovecot/dovecot-mysql.conf
}
userdb sql {
# Path for SQL configuration file, see /etc/dovecot/dovecot-sql.conf for example
args = /etc/dovecot/dovecot-mysql.conf
}
user = root
socket listen {
master {
path = /var/run/dovecot/auth-master
mode = 0600
user = vmail
}
client {
path = /var/spool/postfix/private/auth_dovecot
mode = 0660
user = postfix
group = postfix
}
}
}
邮件日志(简而言之,这些信息每秒都会重复)
May 18 06:24:48 dirty-harry postfix/pickup[20017]: warning: B46BD2416D6: message has been queued for 6 days
May 18 06:24:48 dirty-harry postfix/pickup[20017]: B46BD2416D6: uid=0 from=<root>
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: B46BD2416D6: message-id=<20150518042448.B46BD2416D6@dirty-harry>
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: warning: proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf lookup error for "[email protected]"
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: warning: B46BD2416D6: virtual_alias_maps map lookup problem for [email protected] -- message not accepted, try again later
May 18 06:24:48 dirty-harry postfix/pickup[20017]: warning: B4B262416D6: message has been queued for 2 days
May 18 06:24:48 dirty-harry postfix/pickup[20017]: B4B262416D6: uid=0 from=<root>
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: B4B262416D6: message-id=<20150518042448.B4B262416D6@dirty-harry>
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: warning: proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf lookup error for "[email protected]"
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: warning: B4B262416D6: virtual_alias_maps map lookup problem for [email protected] -- message not accepted, try again later
May 18 06:24:48 dirty-harry postfix/pickup[20017]: warning: B4F932416D6: message has been queued for 8 days
May 18 06:24:48 dirty-harry postfix/pickup[20017]: B4F932416D6: uid=0 from=<root>
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: B4F932416D6: message-id=<20150518042448.B4F932416D6@dirty-harry>
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: warning: proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf lookup error for "[email protected]"
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: warning: B4F932416D6: virtual_alias_maps map lookup problem for [email protected] -- message not accepted, try again later
May 18 06:24:48 dirty-harry postfix/pickup[20017]: warning: B53FA2416D6: message has been queued for 3 days
May 18 06:24:48 dirty-harry postfix/pickup[20017]: B53FA2416D6: uid=0 from=<root>
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: B53FA2416D6: message-id=<20150518042448.B53FA2416D6@dirty-harry>
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: warning: proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf lookup error for "[email protected]"
May 18 06:24:48 dirty-harry postfix/cleanup[20080]: warning: B53FA2416D6: virtual_alias_maps map lookup problem for [email protected] -- message not accepted, try again later
mail.err 和 mail.warn 为空。
如果有人能看一下,我会非常感激!谢谢!
答案1
我现在已经和 Server Fault 这里的伙计们一起找到了解决方案。
有两个问题:
为何我无法接收邮件?
我迁移了服务器并更新了 DNS A 记录,但忘记更新 mx 记录,因此旧服务器仍在接收邮件,其中 postfix 和 dovecot 仍在运行。更新 mx 记录解决了这个问题。
为什么我无法发送邮件并且日志被当作垃圾邮件?
我在 postfix 数据库名称中输入了拼写错误。修复该问题即可解决。