6

Welcome xxx@xxxxx.com! You can confirm your account email through the link below: enter code hereConfirm my account

I want to edit this message to become like this

My project_name Hello xxxxx click here to confirm you email

Mahmoud Abdelaziz
  • 117
  • 1
  • 1
  • 9

3 Answers3

14

Simply generate the devise views

rails g devise:views

then you get access to the default mailing configurations in

your_app/app/views/devise/mailer

  • confirmation_instructions.html.erb
  • reset_password_instructions.html.haml
  • unlock_instructions.html.haml
bulleric
  • 2,077
  • 6
  • 21
  • 36
  • 1
    This is still right with rails 4.2 / Devise 3.5 Note that if you have several devise models, the mail directory will be created in each devise model view directory: `your_app/app/views/user/mailer` and `your_app/app/views/admin/mailer` for example... – gfd Apr 26 '16 at 03:49
4

Check the devise.en.yml to find the devise translations. You can pass the project_name to the translation; for example:

t('welcome', :project_name => project.name)

And in the yml file:

welcome_message: 'My %{project_name} Hello xxxxx click here to confirm you email'

mohamagdy
  • 2,093
  • 2
  • 17
  • 22
  • You mean under mailer: confirmation_instructions: subject: 'Cheeve.it Confirmation instructions' reset_password_instructions: subject: 'Reset password instructions' unlock_instructions: subject: 'Unlock Instructions' – Mahmoud Abdelaziz Sep 10 '12 at 12:10
3

I believe you wanted to customize confirmation_instructions.html.erb file from app\view\resource\mailer when usually resource is users or admin

First of all, check if you set config.scoped_views = true in config/initializers/devise.rb Thanks to this, setup devise is looking for templates in your resource's view folder instead of default one in app\views\devise\mailer

Using login, username etc. is possible in following way <%= @resource.login %>

After all, make sure to restart server. For reference, check similar issue Ruby/Rails: How do you customize the mailer templates of Devise?

Community
  • 1
  • 1
w1t3k
  • 228
  • 2
  • 12