Question

I've just installed Mailboxer (gem 'mailboxer') in my Rails 3.1.1 app… I have the email notifications working.

I followed these instructions to customize the notification email that users receive when they are sent a new message via the Mailboxer engine on my app… This allows me to edit the contents of the email message they receive, but I want to change the 'Subject' in the email header from the default "Mailboxer new message:" to a customized subject.

I'm assuming there might be a line I can add to the mailboxer.rb config file?!?!?

Can anyone help on this?

Was it helpful?

Solution 2

So, I totally missed the obvious on this one... Just need to add a custom mailer, then you have full control.

Add the following to the mailboxer.rb config file:

Mailboxer.setup do |config|
  config.notification_mailer = CustomNotificationMailer
  config.message_mailer = CustomMessageMailer
 ...
end

As clearly noted in the wiki, here.

OTHER TIPS

just change your en.yml file and set your own subjects:

mailboxer.message_mailer.subject_new
mailboxer.message_mailer.subject_reply

the "subject" var contains the mailboxer-message subject. Ex:

en:
  mailboxer:
    message_mailer:
      subject_new: 'Hey, you receive a new message about %{subject}'
      subject_reply: 'Hey, you receive a new reply about %{subject}'

PS: any time you can test the result at console with:

I18n.translate("mailboxer.message_mailer.subject_new", :subject => "hello")

* just change the "hello" for your actual subject

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top