应用程序不会通过发送网格和设计发送确认电子邮件



我一直在寻找解决方案,但到目前为止我还没有工作。

我想设置设计,以便它可以通过 heroku 上的 sendgrid 发送确认邮件。 我为我的应用程序以及添加em403.mydomain.com的 Sendgrid 配置了一个自定义域。我将使用"mydomain.com"进行进一步的解释,我将在我的实际应用程序中替换这些解释。

我的设置:

环境/生产.rb

config.action_mailer.default_url_options = { :host => 'mydomain.com' }
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:user_name            => ENV['SENDGRID_USERNAME'],
:password             => ENV['SENDGRID_PASSWORD'],
:address              => "smtp.sendgrid.net",
:port                 => 587,
:enable_starttls_auto => true,
:authentication       => :plain,
:domain               => "em403.mydomain.com"
}

Initializers/devise.rb

config.mailer_sender = 'hello@mydomain.com'
config.mailer = 'Devise::Mailer'
config.reconfirmable = true
config.confirmation_keys = [:email]

config/environment.rb

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

我不知道为什么它不起作用,因为我按照描述进行了配置。 我也尝试过遵循SendGrid的本教程,它不考虑将设计作为用户身份验证。 即使我尝试将控制器设置实施到我的自定义devise/registrations_controller中。 在我忘记之前: 我还在我的 Heroku 配置中添加了 API 密钥.. 您有什么建议吗?

检查你的秘密.yml 某处没有空间, 检查您的 .env 参数是否已正确发布,

最新更新