我想配置Zoho的邮件的SMTP,我不明白我该怎么办错了。在发展模式一切正常,但在生产中我有,当我发送电子邮件以下错误:Rails的百会网:: SMTPAuthenticationError:530
Net::SMTPAuthenticationError: 530 5.5.1 Authentication Required.
我生产ENV设置:
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: 'not-real.com' }
config.action_mailer.smtp_settings = {
port: 465,
ssl: true,
tls: true,
authentication: :login,
address: 'smtp.zoho.eu',
domain: 'not-real.com',
enable_starttls_auto: true,
password: ENV['ZOHO_PASSWORD'],
user_name: ENV['ZOHO_USER_NAME']
}
首先,在所有我想在错误的密码或USER_NAME问题但不是。接下来,我在Zoho控制面板--->域中检查了域名,但一切都很好。在Zoho SMTP服务器配置说:
Outgoing Server Name: smtp.zoho.eu
Port: 465
Security Type: SSL
Require Authentication: Yes.
但是,请问您能告诉我这是什么意思? - >需要验证:是。
我应该改变在百会设置什么?
解决!实际上,问题在于通过生产环境中的.bashrc文件设置env变量。所以,当我通过Rails.application.config.action_mailer.smtp_settings检查rails控制台中的env变量时,所有选项都存在且正确,但电子邮件无法正常工作。我通过在我的制作中使用dotenv-rails而不是.bashrc文件来解决此问题。在这里,我使用的链接设置.ENV生产https://stackoverflow.com/questions/17150736/environment-variables-on-production –