More in this section
Blogs RSS feed

Changing the default template of email notifications for forms responses

by User Not Found

In the past few weeks there has been increasing number of requests by our clients on how to make a custom template for forms notifications. With this blog post we will create one and register it in our project so that we can customize it further as we like.

Create the custom template

The first thing you need to do is to create an .htm file in your project which will be our custom template. Then paste the following HTML code in it:

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
         <title>New form submission</title>
    <body bgcolor="#f2f2f2" style="background-color: #f2f2f2; padding: 20px 0;">
        <table bgcolor="#fff" width="640px" cellspacing="0" cellpadding="0"border="0" style="width: 640px; margin: 0 auto; padding: 0; background-color: #fff;">
                    <td bgcolor="#f8f8f8" style="background-color: #f8f8f8; padding: 30px 30px 28px;">
                        <h1 style="color: #000; margin: 0; padding: 0; font-family: georgia, arial,verdana,sans-serif; font-style: italic; line-height: 1.2; font-size: 32px; font-weight: normal;">{|Form.ProjectName|}</h1>
                        <span style="color: #333; margin: 0; padding: 0; font-family: arial,verdana,sans-serif; font-style: normal; line-height: 1.2; font-size: 11px; font-weight: normal;">{|Form.Host|}</span>
                    <td style="padding: 31px 30px 20px;">
                        <h2 style="color: #000; margin: 0; padding: 0; font-family: arial,verdana,sans-serif; line-height: 1.2; font-size: 22px; font-weight: normal; font-style: normal;"> New form submission</h2>
                    <td style="padding: 10px 30px 6px;">
                        <h3 style="color: #000; margin: 0; padding: 0; font-family: arial,verdana,sans-serif; line-height: 1.2; font-size: 16px; font-weight: normal; font-style: normal;"><em style="font-style: italic;"><a href="{|Form.Url|}" >{|Form.Title|}</a></em></h3>
                    <td style="padding: 0 30px 28px;">
                        <div style="font-family: arial,verdana,sans-serif; line-height: 1.2; font-size: 11px; font-weight: normal; font-style: normal;">
                        Submitted on {|Form.SubmittedOn|}, via IP {|Form.IpAddress|}
                    <td style="padding: 20px 30px 28px;">

This is the default HTML template which we can now modify as we wish. You can also find it in Sitefinity’s SDK installation folder Content->Resources-> For now just add some <p> or <h1>  tag with some text, so that after the registration we ensure that we have switched the default template. Then we need to set the Build Action to Embedded Resource as it needs to be resolved from an embedded assembly in the next step.

Registering the template

In order to register your custom template you need to create an .aspx page and use the following code in its Page_Load method:

protected void Page_Load(object sender, EventArgs e)
            var formsConfig = Config.Get<FormsConfig>();
            var configManager = ConfigManager.GetManager();
            formsConfig = configManager.GetSection<FormsConfig>();
            var subject = "New form entry is submitted";
            var template = "SitefinityWebApp.Templates.FormsNotification.MyTemplate.htm";
            var assembly = "SitefinityWebApp";
            formsConfig.Notifications.FormEntrySubmittedNotificationTemplateId = CreateFormsNotificationTemplate(subject, template, assembly);
        public Guid CreateFormsNotificationTemplate(string subject, string templateName, string templateAssembly)
            var notificationService = SystemManager.GetNotificationService();
            var serviceContext = new ServiceContext("ThisApplicationKey", FormsModule.ModuleName);
            //create the new template
            var messageTemplate = new MessageTemplateRequestProxy();
            messageTemplate.Subject = subject;
            messageTemplate.BodyHtml = Telerik.Sitefinity.Pages.Model.ControlTemplateResolver.ResolveTemplate(templateName
                , templateAssembly);
            var templateId = notificationService.CreateMessageTemplate(serviceContext, messageTemplate);
            return templateId;

Now build your solution and run the .aspx page in order to register the custom template. Note that you will need to run this page in the browser each time you make modifications to the template so that the new changes are applied to Sitefinity.

If our email notification settings are correct we should now receive a notification email on form submission with our custom template.

I have also uploaded an archive containing the files from the video here.

I hope you found the blog post useful. Any comments and suggestions are highly appreciated.

Are you interested? Let's get started!

Schedule a Demo    Start a trial


Leave a comment
  1. Steve Nov 23, 2012
    What's the timeline to work this into the UI?

    Clients won't be able to build the project if they need a change to the template (since it's an embedded resource)
  2. Diego Dec 06, 2012
    After trying this, there is no longer anything in the body of the email.  How can I roll back?
  3. Scott Rozman Dec 20, 2012
    Diego, it sounds like you may have missed the step of setting the build action on the .htm to be an embedded resource. I was doing this recently and forgot that step. The result was a blank email.
  4. WmBlanks Mar 15, 2013
    Or, you can just go to the DB and update this table: sf_notif_msg_template

    The misspelled value can be found in the 'body_html' field.
  5. Kierstin Mar 14, 2016

    Would the video be stored somewhere else? I can't get it to load here, or the files. 

  6. Patrick Wensel Jan 26, 2017

    Do you have this same thing for MVC?

  7. Nidhi Mar 21, 2017

    Is there a way to change the format of the SubmittedOn date string? Right now it displays in format "dd MMM yyyy", I would like to use "MMM d, yyyy"

  8. MONIKA May 31, 2018
    Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you.MA best personal injury lawyer
  9. MONIKA May 31, 2018
    That is really nice to hear. thank you for the update and good cryptocurrencies
  10. MONIKA May 31, 2018
    Thanks for sharing the post.. parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family.generator perth
  11. MONIKA May 31, 2018
    Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.Detective en Madrid
  12. MONIKA May 31, 2018
    Nice to read your article! I am looking forward to sharing your adventures and experiences.melancong
  13. MONIKA May 31, 2018
    Nice to read your article! I am looking forward to sharing your adventures and experiences.melancong
  14. MONIKA May 31, 2018
    Thanks you very much for sharing these links. Will definitely check this out..painting company Medfield MA
  15. MONIKA May 31, 2018
    Thanks for sharing this useful info..Phone System Installer
  16. MONIKA Jun 04, 2018
    This is really a nice and informative, containing all information and also has a great impact on the new technology. Thanks for sharing it,consulting on cryptocurrencies
  17. MONIKA Jun 08, 2018
    Fantastic blog you have here. You’ll discover me looking at your stuff often. Saved!Detective en Madrid
  18. MONIKA Jun 08, 2018
    This is very interesting content! I have thoroughly enjoyed reading your points and have come to the conclusion that you are right about many of them. You are great.Zwembaden
  19. situs judi terpercaya Jun 12, 2018
    Great articles and great layout. Your blog post deserves all of the positive feedback it’s been getting.situs judi terpercaya
  20. MONIKA Jun 14, 2018
    Your article has piqued a lot of positive interest. I can see why since you have done such a good job of making it interesting.insta likes
  21. Monika Jun 21, 2018
    For over 10 years, Hair Restoration Laboratories has developed and offered to men and women the most effective DHT blocking hair loss shampoos and conditioners to help reverse hair loss and regrow hair.Best shampoo for thinning hair
  22. Richard E. Bailey Jun 26, 2018
    You completed a few fine points there. I did a search on the subject and found nearly all persons will go along with with your blog.Detectives Madrid
  23. MONIKA Jul 09, 2018
    Thanks for the valuable information and insights you have so provided here...More Info
  24. detective Jul 17, 2018
    I read a article under the same title some time ago, but this articles quality is much, much better. How you do this..detective Madrid
  25. Annett Dresdner Jul 21, 2018
    You’ve got some interesting points in this article. I would have never considered any of these if I didn’t come across this. Thanks!.w888

    Leave a comment