ruby-on-rails – 如何自定义Mailboxer电子邮件的模板?
发布时间:2020-12-17 03:35:59 所属栏目:百科 来源:网络整理
导读:它自动发送电子邮件说 You have a new message: subject You have received a new message: Body Visit http://example.com/ and go to your inbox for more info 任何人都知道如何自定义此模板? 如果可能,我想使用i18n作为此模板表单. 谢谢!! . 解决方法
它自动发送电子邮件说
You have a new message: subject You have received a new message: Body Visit http://example.com/ and go to your inbox for more info 任何人都知道如何自定义此模板? 谢谢!! 解决方法
您需要为发送给用户的邮件生成视图
rails g mailboxer:views 这将在< your rails app> / app中生成两个不同的文件夹 1- notification_mailer – 在向用户发送通知时包含模板文件 2- message_mailer – 包含向用户发送消息时的模板文件 您可以更改这些模板. 您可以做的另一件事是在/config/initializer/mailboxer.rb中取消注释/添加这些行 config.notification_mailer = CustomNotificationMailer config.message_mailer = CustomMessageMailer 并创建上面两个必须包含以下函数的邮件程序类 send_email 此链接提供了此函数的参数及其实现.您将获得如何编写自己的send_mail函数的提示. Notification Mailer Send Email function Message Mailer Send Email function (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |