如何根据请求启用/禁用ActionMailer [英] How to enable/disable ActionMailer upon request

查看:55
本文介绍了如何根据请求启用/禁用ActionMailer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要根据用户请求禁用/启用ActionMailer。

I need to disable/enable ActionMailer upon user request.

例如,如果用户选择 disable 电子邮件,则不会发送任何电子邮件直到他打开它。

For example, if user selects disable emails, no email will be sent till he turns it on.

如何做到这一点,不向模型回调添加任何条件

推荐答案

我在邮件拦截器中进行了检查。好文章此处

I check this in mail interceptor. Good article here

这里的巧妙之处是通过邮件中的电子邮件吸引用户。

The inelegant thing here is to get users via their email from the message.

这篇关于如何根据请求启用/禁用ActionMailer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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