在Rail App中不允许使用SendGrid的550个未经身份验证的发件人

时间:2015-09-10 03:56:28

标签: ruby-on-rails heroku

我一直在尝试直接为Rails App集成SendGrid的SMTP设置,以避免使用Heroku帐户的附加组件。根据{{​​3}},我遵循指示,但奇怪的是收到错误消息,请参阅下文。

Heroku日志(错误):

Net::SMTPFatalError (550 Unauthenticated senders not allowed

到config / environment.rb

# Load the Rails application.
require File.expand_path('../application', __FILE__)

# Initialize the Rails application.
Rails.application.initialize!

ActionMailer::Base.smtp_settings = {
  :user_name => ENV['SENDGRID_USERNAME'],
  :password => ENV['SENDGRID_PASSWORD'],
  :domain => 'heroku.com',
  :address => 'smtp.sendgrid.net',
  :port => 587,
  :authentication => :plain,
  :enable_starttls_auto => true
}

1 个答案:

答案 0 :(得分:4)

您必须确保在heroku配置中设置了SENDGRID_USERNAMESENDGRID_PASSWORD

要从命令行执行此操作:

heroku config:set SENDGRID_USERNAME=my_username SENDGRID_PASSWORD=my_pass -app my_app

相关问题