如何自定义Mailboxer电子邮件的模板?

它自动发送电子邮件说

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作为此模板表单。

谢谢!! 。

您需要为发送给用户的邮件生成视图rails g mailboxer:views这将在/app生成两个不同的文件夹

1- notification_mailer - containing template files when a notification is sent to a user

2- message_mailer - containing template files when a message is sent to a user

您可以更改这些模板。

您可以做的另一件事是在/config/initializer/mailboxer.rb取消注释/添加这些行

 config.notification_mailer = CustomNotificationMailer config.message_mailer = CustomMessageMailer 

并创建以上两个邮件程序类,必须包含以下函数

 send_email 

此链接提供了此函数的参数及其实现。 您将获得如何编写自己的send_mail函数的提示。

通知邮件程序发送电子邮件function

Message Mailer发送电子邮件function