Postfix 路由无法传送到中继主机的邮件

Postfix 路由无法传送到中继主机的邮件

当由于某种原因无法在本地传递邮件时,Postfix 会使用中继主机将邮件发送到那里,在我看来这毫无意义。我该如何防止这种情况发生,并向邮政局长发送错误邮件或忽略错误?

主文件:

meta_directory = /nix/store/273x36101hsa1jwfl9xc4g9z4shsfrp5-postfix-3.1.3/etc/postfix
setgid_group = postdrop
command_directory = /nix/store/273x36101hsa1jwfl9xc4g9z4shsfrp5-postfix-3.1.3/bin
sample_directory = /etc/postfix
newaliases_path = /nix/store/273x36101hsa1jwfl9xc4g9z4shsfrp5-postfix-3.1.3/bin/newaliases
mailq_path = /nix/store/273x36101hsa1jwfl9xc4g9z4shsfrp5-postfix-3.1.3/bin/mailq
readme_directory = /nix/store/273x36101hsa1jwfl9xc4g9z4shsfrp5-postfix-3.1.3/share/postfix/doc
sendmail_path = /nix/store/273x36101hsa1jwfl9xc4g9z4shsfrp5-postfix-3.1.3/bin/sendmail
daemon_directory = /nix/store/273x36101hsa1jwfl9xc4g9z4shsfrp5-postfix-3.1.3/libexec/postfix
manpage_directory = /nix/store/273x36101hsa1jwfl9xc4g9z4shsfrp5-postfix-3.1.3/share/man
html_directory = /nix/store/273x36101hsa1jwfl9xc4g9z4shsfrp5-postfix-3.1.3/share/postfix/doc/html
data_directory = /var/lib/postfix/data
shlib_directory = no

#mailbox_transport = lmtp:unix:private/lmtp
mailbox_transport  = lmtp:inet:127.0.0.1:1112
#virtual_transport  = lmtp:inet:127.0.0.1:1112

mydomain = <hidden>
mynetworks = 192.0.0.0/8, 127.0.0.0/8
relay_domains =
mydestination =
    localhost.$mydomain
    localhost
    $myhostname
    $mydomain
append_dot_domain = no
append_at_mydomain = no
compatibility_level = 2
home_mailbox = .local/Maildir/
alias_maps = hash:/etc/aliases

virtual_alias_domains = hash:/etc/postfix/domains
virtual_alias_maps =
    pcre:/etc/postfix/j
virtual_mailbox_base = /var/lib/postfix/virtual

# Receiving SMTP
smtpd_sasl_type = dovecot
smtpd_sasl_path = inet:127.0.0.1:1111
smtpd_sender_login_maps = hash:/etc/postfix/login-domains
smtpd_use_tls=yes
smtpd_tls_auth_only=yes
smtpd_tls_security_level=may
smtpd_tls_CAfile = /etc/postfix/cert/class3.crt
smtpd_tls_key_file = /etc/postfix/cert/postfix-smtp-key.pem
smtpd_tls_cert_file = /etc/postfix/cert/postfix-smtp-cert.pem
#smtpd_sasl_security_options = noanonymous
smtpd_sasl_auth_enable=yes
smtpd_sasl_type=dovecot
smtpd_sasl_path=inet:127.0.0.1:1111
smtpd_relay_restrictions =
    permit_auth_destination
    permit_mynetworks
    permit_sasl_authenticated
    permit_inet_interfaces
    reject_rhsbl_recipient blspamcop.net
    reject_rhsbl_recipient zen.spamhaus.org
    reject_rhsbl_recipient b.barracudacentral.org
    reject_rhsbl_recipient b.barracudacentral.org  Delete
    reject_rhsbl_recipient ae_al_vn.geobl.spameatingmonkey.net
    reject_unauth_destination

# Sending SMTP
relayhost = [ssrs.reachmail.net]
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay-credentials
smtp_tls_security_level = encrypt
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_security_options =

# Debugging
debug_peer_level = 4
debug_peer_list = 127.0.0.1, 192.168.0.0/24, 46.126.224.229, yahoo.com, 52.124.3.12, 65.55.111.145

master.cf:

submission  inet    n   -   n   -       -   smtpd
            -v
            -o smtpd_tls_security_level=encrypt
            -o smtpd_sasl_auth_enable=yes
            -o smtpd_sasl_type=dovecot
            -o smtpd_sasl_path=inet:127.0.0.1:1111
            -o smtpd_sasl_security_options=noanonymous
            -o smtpd_sasl_local_domain=$myhostname
            -o smtpd_client_restrictions=permit_sasl_authenticated,reject
            -o smtpd_sender_login_maps=hash:/etc/postfix/login-domains
smtp        inet    n   -   n   -       -   smtpd -v
smtp        unix    -   -   n   -       -   smtp
relay       unix    -   -   n   -       -   smtp
            -o smtp_helo_timeout=20
            -o smtp_connect_timeout=20
pickup      fifo    n   -   n   60      1   pickup
cleanup     unix    n   -   n   -       0   cleanup
qmgr        fifo    n   -   n   300     1   qmgr
rewrite     unix    -   -   n   -       -   trivial-rewrite
bounce      unix    -   -   n   -       0   bounce
defer       unix    -   -   n   -       0   bounce
flush       unix    n   -   n   1000?   0   flush
proxymap    unix    -   -   n   -       -   proxymap
retry       unix    -   -   y   -       -   error
showq       unix    n   -   n   -       -   showq
error       unix    -   -   n   -       -   error
local       unix    -   n   n   -       -   local
virtual     unix    -   n   n   -       -   virtual
lmtp        unix    -   -   n   -       -   lmtp -v
tlsmgr      unix    -   -   y   300     1   tlsmgr
anvil       unix    -   -   n   -       1   anvil
maildrop    unix    -   n   n   -       -   pipe
            flags=DRhu  user=vmail  argv=/usr/local/bin/maildrop -d ${recipient}

相关内容