I have already made Recoverable module working, so all my setting for mailing are set.
I need to add mettod in my mailer class:
def congrats(user, password)
@user = user
mail(:to => user.email,
:subject => 'Congrats message')
end
I will use http://railscasts.com/episodes/206-action-mailer-in-rails-3 railscast for doing this
I would say bast practice is to not spam your users with a bunch of different emails. However, the easiest way for you to implement this would be to turn on confirmable for your Devise model. And then put your welcome message in the confirmation email.
If you are not using confirmable, or are dead set against having just the one email, why not put this in a callback on your Devise model?
after_create :congrats_email
def congrats_email
mail(to: self.email, subject: "Welcome Message")
end
Either approach is easy enough to implement, you just need to decide which will best suit your users.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.