i'd use sendgrid template send users welcome email when signup site. i've checked out: devise's how-to use customer mailer , done first few steps, however, i'm stuck on put confirmation_instructions
method since need able put in custom information , substitution variables pass through. i'm using devise generated controller controllers/users/...
this have far:
custom class: models/devise_mailer.rb
class devisemailer < devise::mailer helper :application include devise::controllers::urlhelpers default template_path: 'devise/mailer' end
config/initializers/devise.rb
added: config.mailer = "devisemailer"
now here, i'm supposed below, don't know put that. need make custom controller? if so, how make sure new user registrations use method?:
def confirmation_instructions(record, token, opts={}) headers["custom-header"] = "bar" super end
am way off here?
put here:
class devisemailer < devise::mailer helper :application include devise::controllers::urlhelpers default template_path: 'devise/mailer' def self.confirmation_instructions(record, token, opts={}) new(:confirmation_instructions, record, token, opts) end end
(note changed method)
and call wherever want controller this:
current_user.send_confirmation_instructions
Comments
Post a Comment