I'm trying to figure out how to setup my Rails 4 app so that the devise mailer sends through Postmark, using Postmark Templates.
I have postmark-rails gem in my gem file.
I have everything working, except I can't figure out how to give the confirmation token to postmark.
In Postmark I have this template:
To get started, please confirm your account below:
action_url_Value
I can't figure out how to put the following line into the template instead of action url value:
<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></div>
I have added the following to my initializer/devise.rb:
config.mailer = 'PostmarkDeviseMailer'
In postmark_devise_mailer.rb, I have:
class PostmarkDeviseMailer < ActionMailer::Base
include Devise::Mailers::Helpers
def message
mail(
:subject => 'Hello from Postmark',
:to => '[email protected]',
:from => '[email protected]',
:html_body => '<strong>Hello</strong> dear Postmark user.',
:track_opens => 'true')
end
end
default from: "[email protected]"
def confirmation_instructions(record)
devise_mail(record, :confirmation_instructions)
end
def reset_password_instructions(record)
devise_mail(record, :reset_password_instructions)
end
def unlock_instructions(record)
devise_mail(record, :unlock_instructions)
end
The next steps are less clear to me. Has anyone figured out how to use Postmark Templates as the mailer for devise transaction emails?