铁轨 +设计=>全局使用 Devise Mailer 来处理所有邮件发送?
我想在全球范围内使用设计邮件程序, 这样我就不必向我的应用程序添加另一个邮件程序,只需使用设计邮件程序即可在设计视图/控制器之外发送自定义邮件。
已经对此深感渴望,有人知道我如何才能做到这一点吗?
I would like to use the devise mailer globally,
since that way I would not have to add another mailer to my app and just use the devise one, to send custom mails outside the devise views/controllers.
Already digged to long for this, anyone know how I can make this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果重点是只有一个邮件程序,那么让您的一个邮件程序扩展 DeviseMailer 可能会更简单。例如,在应用程序/邮件程序中
例如,此设置将导致所有电子邮件(来自 Devise 和其他方式)均使用
app/layouts/mailer.html.erb
模板发送。请注意,要执行此操作,您确实需要将 Devise 邮件程序模板从
app/views/devise/mailer
移动到app/views/mailer
。If the point is to only have one mailer, it's perhaps more straightforward to have your one single mailer just extend the DeviseMailer. E.g. in app/mailer
This setup will, for example, cause all emails (from Devise and otherwise) to all be sent with the
app/layouts/mailer.html.erb
template.Note that to do this you do need to move the Devise mailer templates from
app/views/devise/mailer
to justapp/views/mailer
.