【问题标题】:Heroku. Sendgrid add-on. There is an Net::SMTPAuthenticationError (535 Authentication failed: account disabled) error when sending emails赫罗库。 Sendgrid 插件。发送电子邮件时出现 Net::SMTPAuthenticationError (535 Authentication failed: account disabled) 错误
【发布时间】:2020-04-25 01:56:20
【问题描述】:

我在 Heroku 上为我的免费应用 (Ruby on Rails) 添加了 Sendgrid 插件。

production.rb文件中的配置:

  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  host = 'mysterious-badlands-89513.herokuapp.com'
  config.action_mailer.default_url_options = { host: host }
  ActionMailer::Base.smtp_settings = {
    :address        => 'smtp.sendgrid.net',
    :port           => '587',
    :authentication => :plain,
    :user_name      => ENV['SENDGRID_USERNAME'],
    :password       => ENV['SENDGRID_PASSWORD'],
    :domain         => 'heroku.com',
    :enable_starttls_auto => true
  }

但是当我尝试触发电子邮件发送时,会出现错误Net::SMTPAuthenticationError (535 Authentication failed: account disabled)

应用日志:

2020-04-25T01:09:46.119736+00:00 app[web.1]: 
2020-04-25T01:09:46.120039+00:00 app[web.1]: I, [2020-04-25T01:09:46.119979 #10]  INFO -- : [5ffafd44-806d-40e5-b0cf-fd87bdaaef67] Completed 500 Internal Server Error in 820ms (ActiveRecord: 5.9ms | Allocations: 6970)
2020-04-25T01:09:46.120762+00:00 app[web.1]: F, [2020-04-25T01:09:46.120706 #10] FATAL -- : [5ffafd44-806d-40e5-b0cf-fd87bdaaef67]   
2020-04-25T01:09:46.120762+00:00 app[web.1]: [5ffafd44-806d-40e5-b0cf-fd87bdaaef67] Net::SMTPAuthenticationError (535 Authentication failed: account disabled
2020-04-25T01:09:46.120763+00:00 app[web.1]: ):
2020-04-25T01:09:46.120763+00:00 app[web.1]: [5ffafd44-806d-40e5-b0cf-fd87bdaaef67]   
2020-04-25T01:09:46.120763+00:00 app[web.1]: [5ffafd44-806d-40e5-b0cf-fd87bdaaef67] app/models/user.rb:50:in `send_activation_email'
2020-04-25T01:09:46.120763+00:00 app[web.1]: [5ffafd44-806d-40e5-b0cf-fd87bdaaef67] app/controllers/users_controller.rb:23:in `create'
2020-04-25T01:09:46.123840+00:00 heroku[router]: at=info method=POST path="/users" host=mysterious-badlands-89513.herokuapp.com request_id=5ffafd44-806d-40e5-b0cf-fd87bdaaef67 fwd="24.80.110.141" dyno=web.1 connect=1ms service=827ms status=500 bytes=1891 protocol=https
2020-04-25T01:09:46.369543+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=mysterious-badlands-89513.herokuapp.com request_id=744e6f86-cca5-45b0-b68e-7fbc5a9ca914 fwd="24.80.110.141" dyno=web.1 connect=1ms service=1ms status=304 bytes=112 protocol=https

另一个奇怪的事情。 当我尝试从 Heroku 上的“资源”选项卡打开 SendGrid 页面时,我只看到“拒绝访问”页面。

有什么想法吗?

【问题讨论】:

  • 这意味着您的帐户已被禁用,如错误消息所示。您需要联系 SendGrid 支持以启用它。

标签: ruby-on-rails heroku sendgrid


【解决方案1】:

您是否在 Heroku 帐户中定义了 ENV['SENDGRID_USERNAME']ENV['SENDGRID_PASSWORD']There is documentation 可以帮助解决这个问题。您收到的错误消息表示您的帐户未启动并正常运行。检查我第一次提到的凭据,否则尝试将 SendGrid 重新配置为 Heroku 中的附加组件。

【讨论】:

  • 是的,这些变量是自动定义的。
【解决方案2】:

我的帐户由于某种原因被禁止了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-11
    • 2015-09-28
    • 2015-06-03
    • 2021-08-10
    • 1970-01-01
    • 2018-01-01
    • 2020-04-17
    • 1970-01-01
    相关资源
    最近更新 更多