Ruby on rails Heroku错误上的Sendgrid

Ruby on rails Heroku错误上的Sendgrid,ruby-on-rails,email,heroku,smtp,sendgrid,Ruby On Rails,Email,Heroku,Smtp,Sendgrid,我已经为我的Heroku帐户设置了Sendgrid,但当应用程序尝试发送邮件时,日志显示以下问题: Net::SMTPFatalError(550无法从指定地址接收: 不允许未经身份验证的发件人 My production.rb设置为: config.action_mailer.delivery_method = :smtp config.action_mailer.raise_delivery_errors = true config.action_mailer.perform_d

我已经为我的Heroku帐户设置了Sendgrid,但当应用程序尝试发送邮件时,日志显示以下问题:

Net::SMTPFatalError(550无法从指定地址接收: 不允许未经身份验证的发件人

My production.rb设置为:

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.perform_deliveries = true
  config.action_mailer.default_url_options = { :host => 'heroku.com' }

  config.action_mailer.smtp_settings = {
    address: "smtp.sendgrid.net",
    port: 587,
    authentication: "plain",
    user_name: ENV["my sendgrid username"],
    password: ENV["my sendgrid password"],
    domain: 'heroku.com'
  }
我的Sendgrid密码/用户名是使用Heroku config-long从Heroku获得的


是否有人对问题所在有任何建议?如何授予我在config.mailer\u发件人身份验证中定义的电子邮件地址?

您的用户名和密码必须是密钥名,而不是值:

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

我的想法是你。

天啊。真是个木偶。我已经盯着它看了好几个小时了。非常感谢。