我正在尝试使用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。
发布于 2020-06-24 21:03:47
没有使用标准的sendgrid gem,但确实看到了这个gem:
https://github.com/eddiezane/sendgrid-actionmailer
这允许动作邮件发送程序通过向config/environments/production.rb添加以下内容来使用api方法
config.action_mailer.delivery_method = :sendgrid_actionmailer
config.action_mailer.sendgrid_actionmailer_settings = {
api_key: ENV['SENDGRID_API_KEY'],
raise_delivery_errors: true
}https://stackoverflow.com/questions/59493448
复制相似问题