![CentOS 上的 Postfix - 无法接收电子邮件](https://linux22.com/image/643900/CentOS%20%E4%B8%8A%E7%9A%84%20Postfix%20-%20%E6%97%A0%E6%B3%95%E6%8E%A5%E6%94%B6%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6.png)
我尝试在我的服务器上设置 Postfix,但没有成功,所以我需要一些帮助(第一次)。
基本上我无法从任何地方接收电子邮件。
如果我向自己或我网络内的其他地址发送电子邮件(例如来自[电子邮件保护]到[电子邮件保护])我收到一个环回错误。
例如,如果我从 Google 发送一封电子邮件,我会收到“中继访问被拒绝”错误,并且无法在我的服务器上接收该电子邮件。
这些是(我认为的)相关的配置文件。
后配置-n
alias_database = hash:/etc/aliases, hash:/etc/mailman/aliases
alias_maps = hash:/etc/aliases, hash:/etc/mailman/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
default_transport = smtp
home_mailbox = /var/mail/
html_directory = no
inet_interfaces = all
inet_protocols = all
local_recipient_maps = unix:passwd.byname
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost
mynetworks = 127.0.0.0/8
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases.postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relay_transport = relay
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
smtp_use_tls = yes
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = hash:/etc/postfix/virtual
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/ssl/certs/postfix.pem
smtpd_tls_key_file = /etc/ssl/private/postfix.pem
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
postfix 主控文件
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd -v
smtpd pass - - - - - smtpd -v
submission inet n - n - - smtpd -v
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
-o append_at_myorigin=no
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
-o smtp_fallback_relay=
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
dovecot unix - n n - - pipe
flags=DRhu user=mailboxes:mailboxes argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop}
amavisfeed unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookup=yes
-o max_use=20
127.0.0.1:10025 inet n - - - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
vacation unix - n n - - pipe
flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} -- ${recipient}
doveconf-n
# 2.0.9: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-042stab093.5 x86_64
auth_debug = yes
auth_mechanisms = plain login
log_path = /var/log/dovecot.log
mail_access_groups = mail
mail_location = mbox:~/mail/:INBOX=/var/mail/%u
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
protocols = imap
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-client {
group = postfix
mode = 0660
user = postfix
}
user = root
}
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
userdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
verbose_ssl = yes
protocol imap {
imap_client_workarounds = delay-newmail tb-extra-mailbox-sep
}
发送到本地主机时出错
Oct 15 17:27:10 hostname postfix/smtpd[7928]: > localhost.localdomain[127.0.0.1]: 250 2.0.0 Ok: queued as E9F18E65234
Oct 15 17:27:10 hostname postfix/smtp[7938]: E9F18E65234: to=<[email protected]>, relay=none, delay=0.16, delays=0.1/0.06/0/0, dsn=5.4.6, status=bounced (mail for mydomain.com loops back to myself)
从 Google 接收时出错
Oct 15 17:52:58 hostname postfix/smtpd[13745]: >>> START Client host RESTRICTIONS <<<
Oct 15 17:52:58 hostname postfix/smtpd[13745]: generic_checks: name=permit_mynetworks
Oct 15 17:52:58 hostname postfix/smtpd[13745]: permit_mynetworks: mail-qc0-f173.google.com 209.85.216.173
Oct 15 17:52:58 hostname postfix/smtpd[13745]: match_hostname: mail-qc0-f173.google.com ~? 127.0.0.0/8
Oct 15 17:52:58 hostname postfix/smtpd[13745]: match_hostaddr: 209.85.216.173 ~? 127.0.0.0/8
Oct 15 17:52:58 hostname postfix/smtpd[13745]: match_list_match: mail-qc0-f173.google.com: no match
Oct 15 17:52:58 hostname postfix/smtpd[13745]: match_list_match: 209.85.216.173: no match
Oct 15 17:52:58 hostname postfix/smtpd[13745]: generic_checks: name=permit_mynetworks status=0
Oct 15 17:52:58 hostname postfix/smtpd[13745]: generic_checks: name=permit_sasl_authenticated
Oct 15 17:52:58 hostname postfix/smtpd[13745]: generic_checks: name=permit_sasl_authenticated status=0
Oct 15 17:52:58 hostname postfix/smtpd[13745]: generic_checks: name=reject_unauth_destination
Oct 15 17:52:58 hostname postfix/smtpd[13745]: reject_unauth_destination: [email protected]
Oct 15 17:52:58 hostname postfix/smtpd[13745]: permit_auth_destination: [email protected]
Oct 15 17:52:58 hostname postfix/smtpd[13745]: ctable_locate: leave existing entry key [email protected]
Oct 15 17:52:58 hostname postfix/smtpd[13745]: NOQUEUE: reject: RCPT from mail-qc0-f173.google.com[209.85.216.173]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-qc0-f173.google.com>
Oct 15 17:52:58 hostname postfix/smtpd[13745]: generic_checks: name=reject_unauth_destination status=2
Oct 15 17:52:58 hostname postfix/smtpd[13745]: > mail-qc0-f173.google.com[209.85.216.173]: 554 5.7.1 <[email protected]>: Relay access denied
Oct 15 17:52:58 hostname postfix/smtpd[13745]: < mail-qc0-f173.google.com[209.85.216.173]: QUIT
Oct 15 17:52:58 hostname postfix/smtpd[13745]: > mail-qc0-f173.google.com[209.85.216.173]: 221 2.0.0 Bye
你们能看看我的配置并帮助我吗?
提前致谢,Arky
答案1
将所有域(您的邮件服务器应该接受邮件)添加到mydestination
范围:
mydestination = $myhostname, mydomain.com, localhost