【问题标题】:Sending mail using Mandrill smtp on rails app在 Rails 应用程序上使用 Mandrill smtp 发送邮件
【发布时间】:2014-10-07 13:49:27
【问题描述】:

我正在使用 Unicorn 和 Nginx 在我自己的服务器上托管一个 Rails 应用程序。当我尝试使用 mandrill 发送邮件时遇到问题,我收到以下错误:

Net::SMTPServerBusy: 401 Syntax: HELO hostname

这是我在 production.rb 上的配置:

config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default charset: 'utf-8'
config.action_mailer.smtp_settings = {
  address: 'smtp.mandrillapp.com',
  port: 587,
  authentication: "plain",
  domain: localhost,
  enable_starttls_auto: true,
  user_name: ENV['MANDRILL_USERNAME'],
  password: ENV['MANDRILL_API_KEY']
}  

我从错误中得到的是,也许 mandrill 拒绝域,因为不是“安全/注册”??

我已经尝试将域更改为“timewarp.us”(尚未注册),我遇到了同样的问题。

如果我更改 madrill 并使用 gmail smtp,它会按预期工作。

这是我第一次部署到服务器,我有点迷路了。

任何帮助都会很棒。谢谢!

【问题讨论】:

    标签: ruby-on-rails email actionmailer


    【解决方案1】:

    尝试添加您的实际域而不是 localhost。我的猜测是 Mandrill 不会接受 localhost 作为主机名。

    【讨论】:

    • 我尝试将“localhost”更改为“timewarp.us”,但仍然出现相同的错误:/
    • 用实际的用户名和密码试一试。它可能不会拾取您的 ENV 变量。另外,我只是尝试 ping 'timewarp.us' 并且无法解析主机名。我猜那是你的问题。
    • 想通了,我没有在我的 Rails 应用程序上使用 figaro,呵呵。我正在使用“secrets.yml”文件..我的错。而不是使用 ENV[''] 必须使用 Rails.application.secrets.
    猜你喜欢
    • 2014-07-28
    • 2014-08-11
    • 2014-09-07
    • 2012-07-06
    • 2021-10-26
    • 2015-08-25
    • 2012-02-11
    • 2015-10-22
    • 2015-11-18
    相关资源
    最近更新 更多