rails应用程序正在向postfix发送一封电子邮件,用于处理From: do-not-reply@some_domain.top返回的错误:
[ActionMailer::MailDeliveryJob] [fa3df6b5-72a4-4a57-a5f8-ef7a98e4d8a9]
Error performing ActionMailer::MailDeliveryJob (Job ID: fa3df6b5-72a4-4a57-a5f8-ef7a98e4d8a9)
from GoodJob(default) in 2613.2ms:
Net::SMTPFatalError (551 5.7.1 Not authorised to send from this header address因此,/etc/postfix/main.cf需要适当的设置。目前:
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
# TLS parameters
smtpd_tls_cert_file=/etc/letsencrypt/live/sandbox.domain.club/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/sandbox.domain.club/privkey.pem
smtpd_tls_security_level=may
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = sandbox.domain.club
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost.$myhostname, localhost, $myhostname
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all多个案例使对文件和/或参考资料的理解复杂化。
现在有两个问题。
sandbox.domain.club-0001,但这很容易修复。如何将后缀配置为使用域(例如,some_domain.top, sandbox.domain.club, twirlingaround.com )?
*注意:尝试了一个这里指出了可能的途径,但是后缀服务器不会启动,因为之前有一个绑定到127.0.0.1,我推测这是因为main.cf的inet_interfaces设置不同。
发布于 2023-05-01 05:51:27
这个问题跟后缀没什么关系,因为
masquerade_domains = some_domain.top sandbox.domain.club twirlingaround.com作为一项安全措施。
问题是rails配置问题之一。需要将config/environment/[acting_environment].rb文件设置为:
config.action_mailer.delivery_method = :sendmail
config.action_mailer.smtp_settings = {
openssl_verify_mode: 'none'
}https://serverfault.com/questions/1130045
复制相似问题