我可以发送邮件但无法接收邮件(带 Postfix 的 CentOS)

我可以发送邮件但无法接收邮件(带 Postfix 的 CentOS)

我跟着教程并能够创建一个可以在电子邮件客户端中配置的邮件帐户。

问题是我的收件箱无法收到任何消息,但我可以完美地发送消息。我尝试从 Gmail 向我新创建的帐户发送电子邮件,但收到一条错误消息,该错误消息自动发送到我的 Gmail,如下图所示。

这是我的配置/etc/postfix/main.cf

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = localhost
mydestination = $myhostname, dougb3ney.com, localhost
unknown_local_recipient_reject_code = 550
alias_database = hash:/etc/aliases
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES


myhostname = mail.dougb3ney.com
mydomain = dougb3ney.com
myorigin = $mydomain
home_mailbox = mail/
mynetworks = 127.0.0.0/8
inet_interfaces = all
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes


smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reje$

smtp_tls_security_level = may
smtpd_tls_security_level = may
smtp_tls_note_starttls_offer = yes
smtpd_tls_loglevel = 1
smtpd_tls_key_file = /etc/postfix/ssl/server.key
smtpd_tls_cert_file = /etc/postfix/ssl/server.crt
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom


smtpd_milters           = inet:127.0.0.1:8891
non_smtpd_milters   = $smtpd_milters
milter_default_action   = accept
milter_protocol         = 2

还,运行它的 CentOS 服务器有一个 mail.dougb3ney.com 的 A 记录。

更新: 邮件仍然没有显示在我的收件箱中,但发件人不再收到失败消息。

我仍然遇到一个奇怪的错误/var/log/maillog

 Nov 10 17:07:27 mail dovecot: pop3-login: Login: user=<email>, method=PLAIN, rip=33.23.4.250, lip=162.243.7.7, mpid=10638, TLS, session=<p1By7zYkXgBgJwT6>
Nov 10 17:07:27 mail dovecot: pop3(email): Disconnected: Logged out top=0/0, retr=0/0, del=0/1, size=1235
Nov 10 17:08:12 mail postfix/submission/smtpd[10653]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Nov 10 17:08:12 mail postfix/submission/smtpd[10653]: warning: cannot get RSA certificate from file /etc/ssl/certs/ssl-mail.pem: disabling TLS support
Nov 10 17:08:12 mail postfix/submission/smtpd[10653]: warning: TLS library problem: 10653:error:02001002:system library:fopen:No such file or directory:bss_file.c:398:fopen('/etc/ssl/certs/ssl-mail.pem','r'):
Nov 10 17:08:12 mail postfix/submission/smtpd[10653]: warning: TLS library problem: 10653:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:400:
Nov 10 17:08:12 mail postfix/submission/smtpd[10653]: warning: TLS library problem: 10653:error:140DC002:SSL routines:SSL_CTX_use_certificate_chain_file:system lib:ssl_rsa.c:722:
Nov 10 17:08:12 mail postfix/submission/smtpd[10653]: connect from mail-qk0-f173.google.com[209.85.220.173]
Nov 10 17:08:12 mail postfix/submission/smtpd[10653]: lost connection after STARTTLS from mail-qk0-f173.google.com[209.85.220.173]
Nov 10 17:08:12 mail postfix/cleanup[10656]: E3BF73FD10: message-id=<[email protected]>
Nov 10 17:08:12 mail postfix/qmgr[10564]: E3BF73FD10: from=<[email protected]>, size=904, nrcpt=1 (queue active)
Nov 10 17:08:12 mail postfix/submission/smtpd[10653]: disconnect from mail-qk0-f173.google.com[209.85.220.173]
Nov 10 17:08:12 mail postfix/local[10658]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Nov 10 17:08:12 mail postfix/local[10658]: E3BF73FD10: to=<[email protected]>, orig_to=<postmaster>, relay=local, delay=0.04, delays=0.02/0.01/0/0, dsn=2.0.0, status=sent (delivered to maildir)
Nov 10 17:08:12 mail postfix/qmgr[10564]: E3BF73FD10: removed
Nov 10 17:08:26 mail dovecot: pop3-login: Login: user=<email>, method=PLAIN, rip=33.23.4.250, lip=162.243.7.7, mpid=10664, TLS, session=<f4P68jYkaABgJwT6>
Nov 10 17:08:27 mail dovecot: pop3(email): Disconnected: Logged out top=0/0, retr=0/0, del=0/1, size=1235

答案1

尝试放入permit_auth_destinationsmtpd_recipient_restrictions和 之间permit_mynetworksreject

如果没有这个,您的本地网络就可以发送邮件,但是没有任何东西可以告诉 postfix 它可以接受某些邮件(例如,对于您的域)。

或者,更改rejectreject_unauth_destination, permit

换句话说,您需要具备:

...,permit_auth_destination,reject

或者

...,reject_unauth_destination,permit

相关内容