Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I customize template of the Mailboxer email?

It automatically delivers email which says

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

Anyone knows how to customize this template? If possible, I'd like to use i18n for this template form.

Thanks!! .

like image 733
MKK Avatar asked Jun 26 '12 01:06

MKK


1 Answers

you need to generate views for the mails that are sent to the user rails g mailboxer:views this will generate two different folders in <your rails app>/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

You can change those templates .

Another thing that you can do is to uncomment/add these lines in /config/initializer/mailboxer.rb

config.notification_mailer = CustomNotificationMailer
config.message_mailer      = CustomMessageMailer

and create above two mailers classes which must contain the following function

send_email

the parameters to this function and their implementation is given on this link . You will get a hint of how to write your own send_mail function .

Notification Mailer Send Email function

Message Mailer Send Email function

like image 137
Kinaan Khan Sherwani Avatar answered Sep 28 '22 05:09

Kinaan Khan Sherwani