只有root才能通过postfix发送邮件

只有root才能通过postfix发送邮件

我已安装并运行 postfix。问题是只有 root 可以发送电子邮件。其他用户无法发送电子邮件。以下是用户 www-data 的日志,它是一个 Web 服务器应用程序。(其他用户也遇到同样的错误)

postfix/smtp[32003]: 513765FEB9: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:11125, delay=2.1, delays=0.07/0/1.7/0.32, dsn=5.0.0, status=bounced (host 127.0.0.1[127.0.0.1] said: 550-Verification failed for <[email protected]> 550-Unrouteable address 550 Sender verify failed (in reply to RCPT TO command))

这是/etc/postfix/main.cf:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain, localhost
relayhost = [127.0.0.1]:11125
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/lizard_password
smtp_sasl_security_options =    
mynetworks = 127.0.0.1/8 [::ffff:127.0.0.1]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost
inet_protocols = ipv4
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination

这是我添加到 /etc/stunnel/stunnel.conf 的部分:

[smtp-tls-wrapper]
accept = 11125
client = yes
connect = smtp.mydomain.com:465

我感谢任何帮助。

答案1

550-Verification failed for <[email protected]> 550-Unrouteable address 550 Sender verify failed (in reply to RCPT TO command))

Gmail 拒绝该邮件,因为发件人地址不可路由(即localhost.localdomain在 DNS 中不存在)。发送邮件时,您需要指定有效的发件人地址。

这可能与您的问题无关,但您不应该使用 stunnel——Postfix 可以自行执行 SSL。

答案2

我不是后缀专家,但我猜它与reject_unauth_destination

来自手动的

reject_unauth_destination
    Reject the request unless one of the following is true:

        Postfix is mail forwarder: the resolved RCPT TO domain matches $relay_domains or a subdomain thereof, and contains no
sender-specified routing (user@elsewhere@domain),
        Postfix is the final destination: the resolved RCPT TO domain matches $mydestination, $inet_interfaces, $proxy_interfaces,
$virtual_alias_domains, or $virtual_mailbox_domains, and contains no
sender-specified routing (user@elsewhere@domain).

相关内容