More in this section

Forums / Developing with Sitefinity / Message Template Programmatic Access

Message Template Programmatic Access

6 posts, 0 answered
  1. John
    John avatar
    61 posts
    Registered:
    08 Jun 2012
    12 Feb 2012
    Link to this post
    Hello,
    Is it possible to access email message template content programmatically? We didn't see a specific Fluent facade for that.

    As an alternative, is there a way to tell the rad editor (HtmlField) to not change the HTML we enter? We currently have a custom form for the admin to edit a simple email template, but the HtmlField seems to alter the HTML that is entered when switching between Design and HTML modes.

    Thanks in advance for any help!
    --
    John
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    14 Feb 2012
    Link to this post

    Hello,
    Thank you for using our services. By default the ContentEditor will strip form and script tags when pasting HTML inside. One option would be to map an external template for the HtmlField template used in the ContentBlock widget designer, and in the custom template specify this.editControl.ContentFilters = Telerik.Web.UI.EditorFilters.None; For your convenience I'm attaching a sample modified template. For more information on mapping external templates to Sitefinity 4.x widgets, please check these resources:
    Customizing Sitefinity 4 Controls with the ViewMap
    Mapping External Templates for Sitefinity 4 Widgets

    If any issues persist, can you please let us know of the exact use case scenario that you need to implement, so maybe we could provide you with a possible workaround or give you a more specific advice.


    All the best,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. John
    John avatar
    61 posts
    Registered:
    08 Jun 2012
    14 Feb 2012
    Link to this post
    Boyan,

    Thank you for this information.

    Can you also tell me how to programmatically retrieve an Email Campaign Message Template contents?

    Thank you!
  4. John
    John avatar
    61 posts
    Registered:
    08 Jun 2012
    16 Feb 2012
    Link to this post
    Bump.

    Anyone know if it's possible to programmatically access an email template added in the Email Campaign | Message Templates section? How would we access these?

    Thanks for any help!
  5. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    17 Feb 2012
    Link to this post
    Hello,

    An email campaign template is actually just a MessageBody with Istemplate property set to true. So you can just say
    var myMessageTemlpate = NewslettersManager.GetManager().GetMessageBodies().Where(mB => mB.IsTemplate == true && mB.Name == "MyTemplateName").FirstOrDefault();



    All the best,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. John
    John avatar
    61 posts
    Registered:
    08 Jun 2012
    17 Feb 2012
    Link to this post
    Boyan,

    That's great news!

    Thank you very much.

    Regards,
    John
6 posts, 0 answered