提问人:Jerome 提问时间:4/22/2023 最后编辑:Jerome 更新时间:4/22/2023 访问量:45
通过带有动态域的后缀邮件发送的 Rails
Rails to send via postfix mail with dynamic domains
问:
应用程序具有多个租户,电子邮件应反映该租户的域。事实上,邮件程序定义了:
from_string = 'do-not-reply@' + shop.shop_value.email_host
subject_string = 'your order at ' + shop.name
mail(
from: from_string,
to: consumer.email,
subject: subject_string
)
然后通过后缀进行处理。但是,这似乎是通过可能的 myhostname 的配置来处理的/etc/postfix/main.cf
myhostname = maindomain.tld
mydestination = $myhostname, maindomain.tld, localhost.online, , localhost
导致以下记录的错误
Delivered mail [email protected]
[...]
] OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 peeraddr=[::1]:25 state=error: certificate verify failed (hostname mismatch)):
现在我已经在相关环境文件中看到了设置的建议
openssl_verify_mode: 'none'
但这似乎总是指一个块......并且定义环境没有目的,因为环境是用以下方式设置的:config.action_mailer.smtp_settings = {}
address, port, domain, disable_start_tls
config.action_mailer.delivery_method = :sendmail
postfix 作为 SMTP 服务器运行,但此服务器配置为仅发送服务器。但是,这些域是使用 SPF 和 DKIM 设置的,以便其他服务器正确处理。
出现了三个问题:
1 - 可以配置为数组。但是 rails 怎么会知道如何移交给 postfix?有必要吗?
2 - 以下命令是否能被 Rails 接受(并且实现速度更快):myhostname
config.action_mailer.smtp_settings = {
openssl_verify_mode: 'none'
}
即smtp_settings仍在渗透到发送邮件处理中。
3 - 有没有办法通过?导轨指南在示例中相当薄sendmail_settings
:arguments
答:
0赞
Jerome
4/22/2023
#1
config.action_mailer.smtp_settings = {
openssl_verify_mode: 'none'
}
可以被 Rails 接受,并允许电子邮件传递给 postfix。
评论