POSTFIX - 发送邮件。我发送出去的邮件被退回

POSTFIX - 发送邮件。我发送出去的邮件被退回

主配置文件

compatibility_level = 2
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix/sbin
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = mail.aufy.pl
mydomain = aufy.pl
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
local_recipient_maps = unix:passwd.byname $alias_maps
unknown_local_recipient_reject_code = 550
mynetworks_style = subnet
mynetworks = 127.0.0.0/8, 192.168.1.100
relayhost = [mail.aufy.pl]:587
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
smtpd_banner = $myhostname ESMTP
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
inet_protocols = ipv4
message_size_limit = 52428800
mailbox_size_limit = 1073741824
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject
smtpd_use_tls = yes
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_cert_file = /etc/letsencrypt/live/aufy.pl/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/aufy.pl/privkey.pem
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_loglevel =  3
smtpd_tls_received_header = yes
milter_protocol = 6
milter_default_action = accept
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891

主配置文件

smtp      inet  n       -       y       -       -       smtpd
submission inet n       -       y       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_tls_auth_only=yes
smtps     inet  n       -       y       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       y       1000?   1       tlsmgr
rewrite   unix  -       -       y       -       -       trivial-rewrite
bounce    unix  -       -       y       -       0       bounce
defer     unix  -       -       y       -       0       bounce
trace     unix  -       -       y       -       0       bounce
verify    unix  -       -       y       -       1       verify
flush     unix  n       -       y       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       y       -       -       smtp
relay     unix  -       -       y       -       -       smtp
        -o syslog_name=postfix/$service_name
showq     unix  n       -       y       -       -       showq
error     unix  -       -       y       -       -       error
retry     unix  -       -       y       -       -       error
discard   unix  -       -       y       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       y       -       -       lmtp
anvil     unix  -       -       y       -       1       anvil
scache    unix  -       -       y       -       1       scache
postlog   unix-dgram n  -       n       -       1       postlogd
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}

日志

Jun 24 16:04:11 mail postfix/submission/smtpd[526358]: 4C11B4E004D: client=mail.aufy.pl[192.168.1.100]
Jun 24 16:04:11 mail postfix/cleanup[526360]: 4C11B4E004D: message-id=<[email protected]>
Jun 24 16:04:11 mail opendkim[897]: 4C11B4E004D: external host mail.aufy.pl attempted to send as aufy.pl
Jun 24 16:04:11 mail postfix/smtp[526362]: 3A83B4E005D: to=<[email protected]>, relay=mail.aufy.pl[192.168.1.100]:587, conn_use=47, delay=0.13, delays=0.07/0.01/0/0.06, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 4C11B4E004D)
Jun 24 16:04:11 mail postfix/qmgr[526209]: 4C11B4E004D: from=<[email protected]>, size=9517, nrcpt=1 (queue active)
Jun 24 16:04:11 mail postfix/qmgr[526209]: 3A83B4E005D: removed
Jun 24 16:04:11 mail postfix/submission/smtpd[526358]: 5C8E14E005D: client=mail.aufy.pl[192.168.1.100]
Jun 24 16:04:11 mail postfix/cleanup[526360]: warning: 5C8E14E005D: message rejected: hopcount exceeded
Jun 24 16:04:11 mail postfix/smtp[526362]: 4C11B4E004D: to=<[email protected]>, relay=mail.aufy.pl[192.168.1.100]:587, conn_use=48, delay=0.09, delays=0.06/0/0/0.02, dsn=5.4.0, status=bounced (host mail.aufy.pl[192.168.1.100] said: 554 5.4.0 Error: too many hops (in reply to end of DATA command))

我是新手,但我配置了我的邮件服务器以接收电子邮件,但我遇到了一个问题,即我的服务器无法向外发送邮件。它总是回环。我有 TLS 连接并使用 Roundcube。我想找一个有经验的人来检查我的 postfix 配置是否正常。你能帮助我吗?

答案1

你为什么有

 relayhost = [mail.aufy.pl]:587  

这告诉服务器将邮件转发给自己,这很可能就是问题所在。如果此服务器旨在将所有邮件转发给上游提供商,请更改中继主机,否则请注释掉此行并重新加载 postfix。(如果您通过其他提供商转发电子邮件,则可能需要进行其他配置)

相关内容