Home
Support Forums

Netlify custom email template variable {{ .ConfirmationURL }} not working

I’m using Netlify Identity for login. After uploading a pair of custom email template for “Confirmation” and “Recovery”, netlify is using the custom templates, but not picking up the variables such as {{ .ConfirmationURL }}

As a result, the confirmation email is sent out with an empty link, breaking the workflow.

For the simplest repro, I simply copied the default template from the documentation, only changing one place in the text so I can more easily tell whether the template is being used:

<h2>Reset Password (Custom Template)</h2>
<p>Follow this link to reset the password for your user:</p>
<p><a href="{{ .ConfirmationURL }}">Reset Password</a></p>

And the resulting email I get is:

Screen Shot 2020-04-03 at 8.07.39 PM

Hi, welcome to the Netlify community forum! I’m not sure why you can’t use {{ .ConfirmationURL }}, if it’s not working, it’s a bit unclear why the docs even mention it. Can you try the following syntax? (Make sure to edit the some/path/ parth):

<h2>Reset Password</h2>

<p>Follow this link to reset the password for your user:</p>
<p><a href="{{ .SiteURL }}/some/path/#recovery_token={{ .Token }}">Reset Password</a></p>

I’m having the same issue here. I have the following template:

    <h1>Hey there!</h1>
    <h2>Just one last quick step!</h2>
    <p>
      <div>SiteURL: "{{ .SiteURL }}"</div>
      <div>ConfirmationURL: "{{ .ConfirmationURL }}"</div>
      <div>Email: "{{ .Email }}"</div>
      <div>NewEmail: "{{ .NewEmail }}"</div>
      <div>Token: "{{ .Token }}"</div>
      We just need you to confirm your email address by clicking
      <a href="{{ .ConfirmationURL }}">HERE</a>

      Doing so will ensure all of us that the right person is being matched to the right 
    account within
      Stripe. You will be taken back to your account on netlify to log in, and you will be 
    connected to
      Stripe where you will be able to securely change your personal information.
    </p>
    <p>
      Again, that link is
      <a href="{{ .SiteURL }}/#confirmation_token={{ .Token }}">Confirm your mail</a>
    </p>
    <p>
      Questions? You may always email us at
      <a 
    href="mailto:support@screwtheninetofive.com">support@screwtheninetofive.com</a> 
    and we will get
       back to you as soon as possible.
    </p>
    <p>Team Screw</p>

And the resulting email is:

The confirm link is: https://mail.google.com/mail/u/0/#m_8366271735243099318_confirmation_token=

I just don’t get the reason why I can’t get the variables to populate here. Is this a paid feature?

Thanks,

Scott

Hi Scott,

I had the same issue, and fixed it by switching from {{ .ConfirmationURL }} to
{{ .SiteURL }}/admin#recovery_token={{ .Token }}.

I’m using Hugo and the admin is in /static/admin/index.html, you may want to adapt the path (/admin) to fit your setup.

If it’s still not working, double-check your settings here and there:

Good luck, this part of Netlify is super useful but a bit messy

1 Like

Thanks for sharing this, @Roneo.org!! :netliconfetti:

1 Like