0
votes

Can anyone tell me , how can i change Confirmation email text in rails 4. I want to send custom text for confirmation when i use "conformable" in rails with devise

Right now email sent is below

Welcome user email here.

You can confirm your account email through the link below:

Confirm my account

Thanks

1
did the post not help?jgraft

1 Answers

0
votes

It's pretty straightforward and Devise has great documentation here which you can reference if you get stuck: Custom Mailers on Devise

Here's the summarized step-by-step:

  1. Create a custom mailer class. You will put this code in your /lib directory. In you /lib directory, create a file called lib/my_mailer.rb and copy the code there. You will then need to require this new class and you can do this at the top of initializer/devise.rb.

lib/my_mailer.rb

class MyMailer < Devise::Mailer
    helper :application # gives access to all helpers defined within `application_helper`.
    include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url`
end

And then in config/initializers/devise.rb

require 'my_mailer'

Devise.setup do |config|
.
.
.
end

The next step is to update the devise mailer setting to point to my_mailer

config/initializers/devise.rb

config.mailer = 'MyMailer'

The last step is to copy the devise mailer views from the Devise gem into a new views folder directly in your app. So inside the Devise gem you are going to go to app/views/mailer and copy the three files from there and paste them into a new directory in your App. You will need to name this new directory in your app as follows app/views/my_mailer/

From there you can directly edit the mailers to your liking.

Hope this helps!