gpt4 book ai didi

ruby-on-rails - Rails ActionMailer 发送没有身份验证的电子邮件

转载 作者:行者123 更新时间:2023-12-01 10:45:49 24 4
gpt4 key购买 nike

因此,我的一个项目有一个 SMTP 服务器,该服务器已配置为无需任何形式的身份验证即可使用。这是我在 config/environments/production.rb 上的 SMTP 设置.

config.action_mailer.asset_host = 'http://example.com'
config.action_mailer.default_url_options = { host: 'example.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
address: 'mail.example.com',
port: 587,
domain: 'info.example.com',
user_name: 'no-reply@example.com',
password: '',
openssl_verify_mode: 'none',
authentication: nil,
tls: false,
enable_starttls_auto: false
}

我虽然 authentication模式需要设置为 nil但是,当我尝试发送电子邮件时,它给了我这个错误。
2.0.0-p481 :001 > CustomerMailer.test.deliver
Net::SMTPAuthenticationError: 503 5.5.1 Error: authentication not enabled

有什么解决办法吗各位

最佳答案

您正在指定身份验证详细信息。 ActionMailer 将相应地使用它们。

解决办法:不要。

config.action_mailer.smtp_settings = {
address: 'mail.example.com',
port: 587,
domain: 'info.example.com'
}

(根据您的服务器配置, domain 参数本身可能是不必要的。)

关于ruby-on-rails - Rails ActionMailer 发送没有身份验证的电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26093514/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com