为什么我的Heroku应用程序不会通过Sendgrid发送电子邮件? [英] Why is my Heroku app not sending emails in production with Sendgrid?

查看:142
本文介绍了为什么我的Heroku应用程序不会通过Sendgrid发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



但是现在我已经推送到Heroku,并且正在使用sendgrid加载项,它们不会被发送。我没有收到错误。似乎它发送的很好,只是它从来没有实际到达我的收件箱。



这是我的 config / environment / production。 rb file:

  config.action_mailer.delivery_method =:smtp 
config.action_mailer。 perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default:charset => utf-8
config.action_mailer.default_url_options = {:host => 'http://myapp.herokuapp.com'}

config.action_mailer.smtp_settings = {
:user_name => ENV [SENDGRID_USERNAME],
:password => ENV [SENDGRID_PASSWORD],
:address => 'smtp.sendgrid.net',
:domain => 'myapp.herokuapp.com',
:port => 587,
:authentication => :plain,
:enable_starttls_auto =>真的
}

我检查了Heroku上的这些配置变量,并返回有效的结果。 / p>

任何想法?



PS我没有指向Heroku应用程序的域名,我只想首先用股票Heroku设置进行测试。

解决方案

p>一切看起来都很好,是否检查sendgrid帐号是否已配置?



如果您使用的是heroku,请转到sendgrid面板完成设置,只需访问应用程序配置文件和资源(默认情况下),您应该看到sendgrid加载项,单击它,只需确保您有所有设置。在这种情况下,它会要求您设置一个模板,但您可以跳过。



希望这有帮助!


My devise emails work fine in development.

But now that I have pushed to Heroku and am using the sendgrid add-on, they don't get sent. I don't get an error. It seems like it is sent just fine, it is just that it never actually reaches my inbox.

This is my config/environment/production.rb file:

config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default :charset => "utf-8"
config.action_mailer.default_url_options = { :host => 'http://myapp.herokuapp.com' }

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

I checked those config vars on Heroku, and they return valid results.

Any ideas?

P.S. I don't have my domain pointing to the Heroku App yet, I just want to test it with the stock Heroku settings first.

解决方案

Everything look good, did you check if the sendgrid account is provisioned?

If you are on heroku, go to the sendgrid panel to finish the setup, just visit the app profile and under resources(which is the default) you should see the sendgrid add-on, click it and just make sure you have everything setup. In this case it will ask you to setup a template, but you can 'skip' this.

Hope this helps!

这篇关于为什么我的Heroku应用程序不会通过Sendgrid发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆