Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise and ActionMailer confusion

I'm using Devise for authentication, and I'm confused on how to set up mail along with it. Should you still be creating your own mailer and initializer file, or should you be sending all mail through Devise? Where do you go in Devise to create the email template and the method for sending the email?

I realize this is kind of a broad question, so essentially I'm asking what is the best way to set up mail with Devise?

Also, if you wanted to send an email to a user after they have confirmed their email, how would you do this?

like image 398
Justin Meltzer Avatar asked Jun 06 '11 04:06

Justin Meltzer


1 Answers

Devise does create it's own Mailer--if you take a look on GitHub https://github.com/plataformatec/devise/blob/master/app/mailers/devise/mailer.rb you can see that it comes with a bunch of methods already packaged in.

You can go ahead and generate the views for these methods using the command

rails g devise views

and then edit them.

If you would like to send additional email messages you should create your own Mailer to do so. I would recommend http://edgeguides.rubyonrails.org/action_mailer_basics.html . It's a pretty good overview of how to set up a mailer from the ground up.

like image 95
Sid Avatar answered Sep 29 '22 19:09

Sid