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



我一直在尝试将SendGrid的SMTP设置直接集成到Rails应用程序中,以避免使用Heroku帐户的附加组件。根据SendGrid的文档,我遵循指示,但奇怪地得到错误信息,请参见下文。

Heroku logs (error):

Net::SMTPFatalError (550 Unauthenticated senders not allowed
配置/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
}

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

从命令行执行:

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

相关内容

最新更新