ViewInBrowserUrl in subscription email template

Mike Rocha asked on January 29, 2021 21:39

Hello, I seem to be having difficulty in creating a subscription email template. I'm on Kentico EMS v12. I've tried to use the macro for ViewInBrowserUrl in my email but it seems to be blank.

{% Email.ViewInBrowserUrl #%}

Using this in email type templates works fine, but for subscription type emails it's blank. Any ideas?

Recent Answers


Daniel Merta answered on February 1, 2021 12:40

Hello Mike,

I can confirm that the Email.ViewInBrowserUrl macro does work only in email templates of the Email type, but does not work in other types (Subscription, Unsubscription, Double opt-in). The reason behind this is that the macro requires subscriber context that available only within the Email type. I've passed this feedback to our technical writers and they'll consider adding this information to our docs. Anyway, thank you for letting us know about this and let me apologize for this inconvenience!

0 votesVote for this answer Mark as a Correct answer

Mike Rocha answered on February 1, 2021 15:15

Thanks for the reply Daniel. It's strange that there is no subscriber context because it's a subscription email. Is there any workaround you're aware of that doesn't use the macro? I tried putting in the URL manually but Kentico requires a valid hash and I can't seem to reproduce one.

0 votesVote for this answer Mark as a Correct answer

Daniel Merta answered on February 1, 2021 15:55

Hi Mike, the macro was constructed to work only together with the Email type of template. The Insert macro dialog shouldn't be offering the macro in question to choose in other types of templates, although it currently does. Our devs will take a look at it if is possible to make it work also in other types, or if we hide the macro accordingly. I regrettably cannot say what the result will be. As a workaround, you could create your own macro (Extending the macro engine) that will resolve into a link to some page where you display a confirmation message. Or even simpler would be to put a standard link to the email template that will lead to the same page.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.