Create .html file during building an email in Email Builder.

Michał Gajdziel asked on March 16, 2021 06:51

I have a site with Kentico EMS licence. I seek an advice in a case of "Email Marketing" Application.

My goal is to create a .html file, e. g. in ~/Site Name/Emails/Example-email.html location, or even have a direct public link to preview email (the link needs to be included in sended email). The email file or link needs to be accessible from the level of editing it (in email builder tab), or at least create after send test email. I did some research in this case, and I noticed that the Email (in .html) is not stored in database. Data about email is stored as Template in Newsletter_EmailTemplate table (.html) + Information about widgets in Newsletter_NewsletterIssue table (.xml). Data is saved in database quite late, e.g. on send Marketing Campaign (we can't give a client, a possibility to test the link to "created file" in Preview mode).

I have two ideas how to aprouch this task:

a) on autosave or click on preview button event in Email Builder tab, somehow get a .html code and create an .html file.

b) on send test email, conditionally catch email .html code and create an .html file.

Seeing above options, do you think am I going in the right direction or whether is exist a better way to do this? Maybe the whole email is stored somewhere?

Correct Answer

Jeroen Fürst answered on March 16, 2021 08:08

Hi Michal,

Can you tell us more about what you are trying to achieve with the html files? And which version of Kentico Xperience are you using?

If it's regarding viewing the mails after they have been send with the email marketing in Kentico Xperience, then this is possible using the macro: {% Email.ViewInBrowserUrl #%} in the email template. This will automatically generate the URL to the preview of the mail on the live site.

Alternatively you could look into global event handlers but I doubt this is what you want to do.

Cheers, Jeroen

0 votesVote for this answer Unmark Correct answer

Recent Answers


Michał Gajdziel answered on March 16, 2021 09:55 (last edited on March 16, 2021 09:56)

Hi Jeroen,

You are right, this macro: {% Email.ViewInBrowserUrl #%} is exactly what I needed.

Thank you for the answer!

0 votesVote for this answer Mark as a Correct answer

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