0

I know that with the Mandrill syntax that I can send in user specific info by doing something like this:

def confirmation_instructions(record, token, opts={})
  options = {
    :subject => 'Email confirmation',
    :email => record.email,
    :name => record.first_name,
    :global_merge_vars => [
      {
        name: 'email',
        content: record.email
      },
      {
        name: 'confirmation_link',
        content: record.confirmation_token
      }
    ],
    :template => 'confirm_email'
  }
  mandrill_send(options)
end

but how do I send the actual confirmation link that is in the devise confirmation instructions html.erb?

views/confirmable/mailer/confirmation_instructions.html.erb

<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>

UPDATE

I edited so I send this link:

content: 'http://localhost:3000/users/confirmation?confirmation_token=' + record.confirmation_token

It still doesn't work, I think because the token is actually encrypted. I'm thinking this is the case because when I use the default mailer the token is a lot shorter than the token I get from record.confirmation_token.

Can someone let me know how to pass the correct token to Mandrill?

ecoding5
  • 404
  • 6
  • 19

1 Answers1

0

I had the same issue, what worked for me was using 'token' instead of 'record.confirmation_token'. It seems that Devise's latests updates changed some Mailer's methods config.

Instead of: http://domain.com/users/confirmation?confirmation_token=' + record.confirmation_token

Use: http://domain.com/users/confirmation?confirmation_token=' + token

Let me know if it helps you.

jogam5
  • 186
  • 1
  • 4
  • I have since moved on to just using the default devise template with mandrill. I'll update this if/when I use another template. Thanks for your answer though! – ecoding5 Dec 01 '14 at 16:40