【问题标题】:RefineryCMS inquiries not sending emailRefineryCMS 查询未发送电子邮件
【发布时间】: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

【问题讨论】:

  • 您是否使用&lt;&gt; 块包装您的电子邮件?您需要 HELO 域吗?或者您可以删除域参数。如果你硬编码它,它是否可以在没有环境变量的情况下工作?
  • 不,我不是,我会改变那个例子。我还没有改变我的 A 记录,也许我应该
  • 是的,你需要这样写电子邮件&lt;map7@gmail.com&gt;

标签: ruby-on-rails email gmail actionmailer refinerycms


【解决方案1】:

您应该将您的电子邮件包裹在&lt;&gt; 块中。

export MAILER_USERNAME="<map@gmail.com>"
export MAILER_PASSWORD="password"

【讨论】:

    【解决方案2】:

    我发现问题不在于电子邮件周围的括号,而在于我还没有为那台机器设置 DNS。一旦我昨晚这样做并以它的域而不是IP访问了refinerycms网站,然后我就可以发送电子邮件了。

    【讨论】:

      猜你喜欢
      • 2015-09-16
      • 2020-06-02
      • 2014-10-26
      • 2020-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-12
      相关资源
      最近更新 更多