【发布时间】:2016-04-11 06:57:28
【问题描述】:
我正在使用旧的 RefineryCMS 1.0.8 项目并将其迁移到另一台服务器。除了联系我们表格之外,这一切都有效。
这是我在 production.rb 文件中的设置
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
config.action_mailer.delivery_method = :sendmail
# Defaults to:
# config.action_mailer.sendmail_settings = {
# location: '/usr/sbin/sendmail',
# arguments: '-i -t'
# }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
if ENV['MAILER_USERNAME'].present? && ENV['MAILER_PASSWORD'].present?
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "my_domain.com.au",
user_name: "#{ENV['MAILER_USERNAME']}",
password: "#{ENV['MAILER_PASSWORD']}",
authentication: 'plain',
enable_starttls_auto: true
}
end
我已经在我的 /etc/environment 和 /etc/apache2/envvars 文件中设置了环境变量,就像这样;
export MAILER_USERNAME="<email address>"
export MAILER_PASSWORD="<password>"
我也将 tld 的长度设置为 2,就像我们在澳大利亚一样,所以我们使用的是 .com.au。这是在我的 config/application.rb 中设置的
config.action_dispatch.tld_length = 2
这是我得到的错误;
Sent mail to <my gmail address> (2924ms)
There was an error delivering an inquiry confirmation:
555 5.5.2 Syntax error. w20sm33182626pfi.31 - gsmtp
【问题讨论】:
-
您是否使用
<>块包装您的电子邮件?您需要 HELO 域吗?或者您可以删除域参数。如果你硬编码它,它是否可以在没有环境变量的情况下工作? -
不,我不是,我会改变那个例子。我还没有改变我的 A 记录,也许我应该
-
是的,你需要这样写电子邮件
<map7@gmail.com>
标签: ruby-on-rails email gmail actionmailer refinerycms