【问题标题】:Sendgrid not sending emailsSendgrid不发送电子邮件
【发布时间】:2016-11-15 13:02:38
【问题描述】:

我将sendgrid 添加到 Heroku 上的应用程序中作为我的电子邮件发件人,但每次用户尝试注册时,都会出现错误并显示文本“www.mydomain.com" is currently unable to handle this request"。Heroku 日志没有显示任何错误。这是我的@ 987654323@:

config.action_mailer.smtp_settings = {
  :address        => "smtp.sendgrid.net",
  :port           => "587",
  :authentication => :plain,
  :user_name      => "<%= ENV['SENDGRID_USERNAME'] %>",
  :password       => "<%= ENV['SENDGRID_PASSWORD'] %>",
  :domain         => "mydomain.com",
  :enable_starttls_auto => true
}

【问题讨论】:

  • 您是通过电子邮件发送图片还是纯文本?
  • 纯文本,这是一封带有设计@bkunzi 的确认电子邮件
  • 也许是需要为生产设置 Devise 的密钥的问题,但我不能确定。
  • 您现在的记录器级别配置是什么?通过提高该级别,您可能可以获得更多信息。

标签: ruby-on-rails heroku sendgrid


【解决方案1】:

我终于得到了答案,我必须设置更改初始化器/设计来自

 config. mailer_sender = mail

 config. mailer_sender = mail@example.com

【讨论】:

    【解决方案2】:

    在您发布的所有内容下方的 smtp_settings 哈希之外添加:

    config.action_mailer.default_url_options = { host: 'http://somedomain.com' }
    

    另外,请确保您将用户名和密码的环境变量添加到 Heroku!

    【讨论】:

    • 一切正常,我只是不知道 sendgrid 上的错误发生在哪里,因为 Heroku 日志根本没有显示错误。
    猜你喜欢
    • 2018-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-30
    • 2018-11-08
    • 1970-01-01
    相关资源
    最近更新 更多