我最近在我的 VPS (OVH) 上设置了一个 postfix/dovecot 邮件服务器,但出于某种原因,我无法通过它接收电子邮件。有谁能检查我的 DNS 记录和 Postfix/dovecot 配置,看看我哪里出了问题。
我的域名是 jeroened.be,邮件由 mail.jeroened.be 处理
提前致谢
DNS:
mail 0 IN CNAME vps115965.ovh.net.
0 IN MX 10 mail
mail 0 IN A 5.196.227.108
mail 0 IN AAAA 2001:41d0:51:1::1e68
后缀:
[jeroen@vps105180 ~]$ sudo postconf -n
alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
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_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 104857600
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = jeroened.be
myhostname = mail.jeroened.be
mynetworks = 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relay_domains = *
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_path = /var/run/dovecot/auth-client
smtpd_sasl_security_options = noanonymous
smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/pki/tls/certs/mail.jeroened.be.crt
smtpd_tls_key_file = /etc/pki/tls/private/mail.jeroened.be.key
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/vmail_aliases
virtual_gid_maps = static:2223
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = hash:/etc/postfix/vmail_domains
virtual_mailbox_maps = hash:/etc/postfix/vmail_mailbox
virtual_minimum_uid = 2222
virtual_transport = virtual
virtual_uid_maps = static:2222
鸽舍:
[jeroen@vps105180 ~]$ sudo doveconf -n
# 2.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-042stab103.6 x86_64 CentOS Linux release 7.0.1406 (Core) simfs
auth_mechanisms = plain login
default_login_user = vmail
disable_plaintext_auth = no
first_valid_gid = 2222
first_valid_uid = 2222
mail_access_groups = vmail
mail_location = maildir:/var/vmail/%d/%n
passdb {
args = scheme=SHA1 /etc/dovecot/passwd
driver = passwd-file
}
protocols = imap pop3
service auth {
unix_listener auth-client {
group = postfix
mode = 0660
user = postfix
}
user = root
}
service imap-login {
process_min_avail = 1
user = vmail
}
ssl_cert = </etc/pki/tls/certs/mail.jeroened.be.crt
ssl_key = </etc/pki/tls/private/mail.jeroened.be.key
userdb {
args = uid=2222 gid=2222 home=/var/vmail/%d/%n allow_all_users=yes
driver = static
}
邮件日志(请求):
[jeroen@vps105180 ~]$ sudo tail /var/log/maillog
Feb 20 20:35:00 vps105180 postfix/anvil[16609]: statistics: max connection count 1 for (smtp:unknown) at Feb 20 20:31:40
Feb 20 20:35:00 vps105180 postfix/anvil[16609]: statistics: max cache size 1 at Feb 20 20:31:40
Feb 20 20:43:20 vps105180 postfix/qmgr[15505]: CF1A812217D7: from=<[contact e-mai]>, size=71118, nrcpt=1 (queue active)
Feb 20 20:43:20 vps105180 postfix/virtual[8454]: CF1A812217D7: to=<[my e-mail]@jeroened.be>, relay=virtual, delay=8895, delays=8895/0.07/0/0.03, dsn=4.2.0, status=deferred (delivery failed to mailbox /var/vmail/jeroened.be/[my e-mail]: cannot open file: Is a directory)
Feb 20 20:48:20 vps105180 postfix/qmgr[15505]: 1620712217DD: from=<[contact e-mai]>, size=40090, nrcpt=1 (queue active)
Feb 20 20:48:20 vps105180 postfix/virtual[20307]: 1620712217DD: to=<[my e-mail]@jeroened.be>, relay=virtual, delay=8910, delays=8910/0.12/0/0.03, dsn=4.2.0, status=deferred (delivery failed to mailbox /var/vmail/jeroened.be/[my e-mail]: cannot open file: Is a directory)
Feb 20 20:52:12 vps105180 dovecot: imap-login: Login: user=<[my e-mail]@jeroened.be>, method=PLAIN, rip=178.50.74.180, lip=5.196.227.108, mpid=27858, TLS, session=<doaCY4oPQwCyMkq0>
Feb 20 20:52:14 vps105180 dovecot: imap([my e-mail]@jeroened.be): Connection closed in=1488 out=116410
Feb 20 20:53:20 vps105180 postfix/qmgr[15505]: A773312217DB: from=<[contact e-mai]>, size=13191, nrcpt=1 (queue active)
Feb 20 20:53:20 vps105180 postfix/virtual[29577]: A773312217DB: to=<[my e-mail]@jeroened.be>, relay=virtual, delay=8847, delays=8847/0.08/0/0.03, dsn=4.2.0, status=deferred (delivery failed to mailbox /var/vmail/jeroened.be/[my e-mail]: cannot open file: Is a directory)
后队列(请求):
[jeroen@vps105180 ~]$ sudo postqueue -p
7322712217DB* 5258 Sat Feb 21 17:47:02 [e-mail hidden]
[e-mail hidden]
EE85F12217EE* 22948 Sun Feb 22 07:25:21 [e-mail hidden]
[e-mail hidden]
C5E4612217E8* 9562 Sat Feb 21 17:26:28 [e-mail hidden]
[e-mail hidden]
6DD8C12217E0* 46645 Sat Feb 21 17:47:02 [e-mail hidden]
[e-mail hidden]
9D13E12217F1* 110258 Sun Feb 22 11:00:18 [e-mail hidden]
[e-mail hidden]
AE11712217DC* 4827 Sat Feb 21 17:29:47 [e-mail hidden]
[e-mail hidden]
AB97312217C2* 4231 Sat Feb 21 17:14:30 [e-mail hidden]
[e-mail hidden]
C04981221808* 18003 Sat Feb 21 17:36:29 [e-mail hidden]
[e-mail hidden]
CB21B12217F4* 78006 Sun Feb 22 11:30:50 [e-mail hidden]
[e-mail hidden]
64FE012217DE* 35693 Sun Feb 22 14:09:28 [e-mail hidden]
[e-mail hidden]
6F91812217FC* 1293 Sat Feb 21 22:15:37 [e-mail hidden]
[e-mail hidden]
EE39312217F8* 20283 Sun Feb 22 11:43:18 [e-mail hidden]
[e-mail hidden]
EB31712217F5* 483 Sun Feb 22 11:37:11 [e-mail hidden]
[e-mail hidden]
81D0512217BD* 14735 Sun Feb 22 04:55:03 [e-mail hidden]
[e-mail hidden]
BB8CC12217E2* 4372 Sun Feb 22 11:42:22 [e-mail hidden]
[e-mail hidden]
9A2B112217EA* 2038 Sun Feb 22 03:00:38 [e-mail hidden]
[e-mail hidden]
7FF1F12217E9* 5258 Sat Feb 21 17:36:47 [e-mail hidden]
[e-mail hidden]
5DF2C12200E8* 2799 Sat Feb 21 17:36:47 [e-mail hidden]
[e-mail hidden]
C27291221805* 4426 Sun Feb 22 16:51:45 [e-mail hidden]
[e-mail hidden]
D9A5912217F6* 7642 Sun Feb 22 11:43:18 [e-mail hidden]
[e-mail hidden]
6A6851221804* 692 Sun Feb 22 16:32:08 [e-mail hidden]
[e-mail hidden]
481F012217E3* 9015 Sat Feb 21 17:26:44 [e-mail hidden]
[e-mail hidden]
CBD1712217B9* 13467594 Sat Feb 21 15:23:52 [e-mail hidden]
[e-mail hidden]
BF0B612217D7* 817 Sun Feb 22 16:56:37 [e-mail hidden]
[e-mail hidden]
B759212217D2* 11127 Sat Feb 21 16:15:24 [e-mail hidden]
[e-mail hidden]
C43241221807* 4327 Sun Feb 22 17:14:35 [e-mail hidden]
[e-mail hidden]
D6D1C12217E4* 9263 Sat Feb 21 17:26:42 [e-mail hidden]
[e-mail hidden]
42AFC12217D8* 30506 Sat Feb 21 18:27:47 [e-mail hidden]
[e-mail hidden]
7100612217ED* 7985 Sat Feb 21 17:06:06 [e-mail hidden]
[e-mail hidden]
B61F612217D4* 667 Sun Feb 22 16:11:19 [e-mail hidden]
[e-mail hidden]
B774912217EF* 4514 Sat Feb 21 17:36:29 [e-mail hidden]
[e-mail hidden]
9FB0D12217F3* 100585 Sun Feb 22 11:20:23 [e-mail hidden]
[e-mail hidden]
8D43212217FD* 21447 Sun Feb 22 13:55:43 [e-mail hidden]
[e-mail hidden]
8B5B712217E5* 9090 Sat Feb 21 17:26:29 [e-mail hidden]
[e-mail hidden]
ED67312217D6* 692 Sun Feb 22 10:43:58 [e-mail hidden]
[e-mail hidden]
C92EC12217D9* 46759 Sat Feb 21 17:36:47 [e-mail hidden]
[e-mail hidden]
A98A412217EB* 263 Sun Feb 22 15:14:36 [e-mail hidden]
[e-mail hidden]
BCAC512217F0* 1293 Sat Feb 21 22:13:05 [e-mail hidden]
[e-mail hidden]
6B92D12217FE* 870 Sun Feb 22 15:31:10 [e-mail hidden]
[e-mail hidden]
B38EC12217E6* 34492 Sun Feb 22 08:07:15 [e-mail hidden]
[e-mail hidden]
CAEC612217D3* 1003 Sat Feb 21 22:24:21 [e-mail hidden]
[e-mail hidden]
7C7911221806* 4579 Sun Feb 22 16:43:19 [e-mail hidden]
[e-mail hidden]
6D5321221800* 4372 Sun Feb 22 13:55:33 [e-mail hidden]
[e-mail hidden]
788D112217E1* 2857 Sun Feb 22 16:33:19 [e-mail hidden]
[e-mail hidden]
1FDAB12217DD* 646 Sun Feb 22 17:08:17 [e-mail hidden]
[e-mail hidden]
A07DD1221809* 3451 Sat Feb 21 15:34:21 MAILER-DAEMON
[e-mail hidden]
BDADB12217EC* 4241 Sat Feb 21 17:13:57 [e-mail hidden]
[e-mail hidden]
C10F412217F9* 141397 Sun Feb 22 12:03:38 [e-mail hidden]
[e-mail hidden]
答案1
问题已解决。
正如评论中看到的,有一个问题说我的日志不起作用。这个问题按照问题中的说明解决了这里(考虑到 CentOS 7,这是未批准的答案)
日志再次工作后,解决方案只需 5 秒钟即可解决。日志显示以下错误:
Feb 22 18:15:27 vps105180 postfix/virtual[26358]: fatal: main.cf configuration error: virtual_mailbox_limit is smaller than message_size_limit
我知道我必须更改此选项,因为我有时会发送一些大文件(大约 20MB)。但我没有更改其他选项,因为我不知道这个问题。通过更改此选项,问题得到解决,我的电子邮件立即收到。
特别感谢 masegaloeh 和所有帮助我找到答案的人。
答案2
由于您暗示您没有收到任何错误,我想知道您设置的邮箱是否与Dovecot 虚拟邮箱结构/etc/postfix/vmail_mailbox
不匹配/var/vmail/%d/%n
。例如,我预计它包含以下内容:
[email protected] jeroened.be/leesinblik/
无论如何,请查看 /var/vmail 目录并查看您发送的邮件去了哪里。
答案3
看起来你失踪了最后一个斜线当您在中指定 maildir 目录时/etc/postfix/vmail_mailbox
。
virtual_mailbox_maps(默认值:空)
...
虚拟(8)投递代理使用此表来查找每个收件人的邮箱或 maildir 路径名。如果查找结果以斜线(“/”)结尾,则执行 maildir 样式的投递,否则假定路径指定 UNIX 样式的邮箱文件。请注意,$virtual_mailbox_base 无条件地添加到此路径的前面。
事实是:postfix 不会在以下情况下失败:接受电子邮件,但失败时储存这就是为什么另一个用户报告说他们成功向您的服务器发送了一封电子邮件。
答案4
看来你的配置没问题,我给你发了一封测试邮件[电子邮件保护],这是你的服务器的回复:
Feb 22 14:57:22 iabsis postfix/smtp[12704]: DDAE720052E: to=<[email protected]>, relay=mail.jeroened.be[5.196.227.108]:25, delay=6.5, delays=0.33/0.02/6.1/0.03, dsn=5.1.1, status=bounced (host mail.jeroened.be[5.196.227.108] said: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in virtual mailbox table (in reply to RCPT TO command))
这意味着您的服务器接受邮件,但收件人不存在(您的服务器上没有“测试”帐户)。