У меня установлен и работает postfix. Проблема только в том, что root может отправить письмо. другие пользователи не смогли сделать. Вот журнал для пользователя www-data, который является приложением веб-сервера. (та же ошибка для других пользователей)

postfix/smtp[32003]: 513765FEB9: to=<xxxx@gmail.com>, 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 <www-data@localhost.localdomain> 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

Я ценю любую помощь.

2 ответа2

0
550-Verification failed for <www-data@localhost.localdomain> 550-Unrouteable address 550 Sender verify failed (in reply to RCPT TO command))

Gmail отклоняет сообщение, потому что адрес отправителя не маршрутизируемый (то есть localhost.localdomain не существует в DNS). Вам необходимо указать действительный адрес отправителя при отправке почты.

Вероятно, это не связано с вашей проблемой, но вы не должны использовать stunnel - Postfix может делать SSL сам по себе.

0

Не эксперт по постфиксам, но я собираюсь догадаться, что это как-то связано с 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).

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .