Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Own Mailer Class + Postmark Templates. Magic Link not working #8

Closed
freebian opened this issue Oct 9, 2021 · 2 comments
Closed

Own Mailer Class + Postmark Templates. Magic Link not working #8

freebian opened this issue Oct 9, 2021 · 2 comments

Comments

@freebian
Copy link

freebian commented Oct 9, 2021

Hi,

I am using https://postmarkapp.com/ email template for all my emails.
Unfortunately I cannot figure out how to send working magic links via postmark templates.

I've overwritten the mailer method and set a custom Mailer inside the Devise's initializer, wich works.
The issue is that the following seems to generate an invalid magic link?
Do I miss something here?

def magic_link(record, token, remember_me, opts = {})
      self.template_model = {
        user: {
          magic_link_url: send("users_magic_link_url", Hash["user", {email: record.email, token: token, remember_me: remember_me}]),
          magic_link_validity: Devise.passwordless_login_within.inspect
        }
      }
      mail to: record.email, postmark_template_alias: 'magic-link'
end

Any hints appreciated,
Thanks a lot.

@freebian
Copy link
Author

This does actually work. I had a comma at the end which I did no realise. Sorry about that.

@abevoelker
Copy link
Owner

No problem; didn't get a chance to look at your issue before you figured it out, but glad you did 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants