首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用API方法代替SMTP - SendGrid的Rails ActionMailer

使用API方法代替SMTP - SendGrid的Rails ActionMailer
EN

Stack Overflow用户
提问于 2019-12-27 05:02:53
回答 1查看 601关注 0票数 3

我正在尝试使用Rails 5.2和Sendgrid发送邮件。我已经阅读了如何设置它的教程。然而,我找到的所有方法都是设置发送的SMTP方法,它比API方法慢。示例:https://medium.com/le-wagon/how-to-send-email-with-action-mailer-and-sendgrid-in-rails-5-32ed0c9167fd

使用标准的sendgrid gem:https://github.com/sendgrid/sendgrid-ruby

有没有使用action mailer和API方法发送电子邮件的方法?我不想只使用api密钥进行身份验证,我想使用api发送邮件,而不是SMTP。

EN

回答 1

Stack Overflow用户

发布于 2020-06-24 21:03:47

没有使用标准的sendgrid gem,但确实看到了这个gem:

https://github.com/eddiezane/sendgrid-actionmailer

这允许动作邮件发送程序通过向config/environments/production.rb添加以下内容来使用api方法

代码语言:javascript
复制
config.action_mailer.delivery_method = :sendgrid_actionmailer
config.action_mailer.sendgrid_actionmailer_settings = {
  api_key: ENV['SENDGRID_API_KEY'],
  raise_delivery_errors: true
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59493448

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档