custom confirmation mail with dynamic subject in devise
authentication, devise, email, ruby-on-rails, ruby-on-rails-3
Solution
I fixed this issue by creating a subclass of `Devise::Mailer`
class DeviseMailer < Devise::Mailer
def reset_password_instructions(record, token, opts={})
mail = super
# custom logic
mail.subject = "[Dynamic Subject]"
mail
end
end
and customized devise.rb in initializer to call the custom emailer
config.mailer = 'DeviseMailer'
Problem
I want to customize devise confirmation mail subject with dynamic content. I have tried to achieve that by using this link. There is no change. It is taking the "Confirmation Instructions" string from devise.en.yml. then I have changed in devise.en.yml file. It has been reflected but anyway It is static change. But I need to change the subject with dynmaic content. Please guide me to fix this issue.