Hi guys! I’ve been working on a custom email template and it’s working pretty nicely… except for an issue I’m having with Rich Text fields.
I’ve created a module which has fields for an image and accompanying text. This text needs to have formatting options so that my colleagues can add bold, additional hyperlinks, etc. For example, like this:
This is a paragraph with bold text.
If I call the value of the input on this field, {{ module.content_text }}, it’s rendered as a regular string. So the html tags are visible for the receiver, like
<p>This is a paragraph with <strong>bold</strong> text.</p>
In the editor view it’s all rendered as it should, but once I preview the mail as a contact or send the test mail, it’s not rendered as html.
@rhubner if you are wanting the HTML to appear in the email, it won’t, it’s going to render the HTML regardless of whether the code is visible in the message or added via the source code.
if you want the “bold” to render and it’s not, can you share a screenshot of the actual email in edit mode vs preview vs test? It would be helpful to see how you’ve implemented.
I’ve added some images. One is the code view of the module, one is the view of the email editor where the html is rendered as it should, the third image is of the output as seen in a sent test mail and when previewing as a contact.
It sounds like the issue you’re experiencing is related to rendering HTML content in your email template. Here are a few things you can check and try to resolve the problem: Ensure HTML Rendering is Enabled: Some email clients may disable HTML rendering by default for security reasons. Make sure that the email client you’re using supports HTML content and that HTML rendering is enabled. Verify Content-Type: Ensure that the Content-Type of your email is set to HTML. This can usually be done through the email template settings or by specifying the Content-Type header in the email message. Use Triple Curly Braces: When rendering HTML content in your email template, use triple curly braces ({{{ }}}) instead of double curly braces ({{ }}). Triple curly braces prevent escaping of HTML entities and allow the HTML tags to be rendered as intended. Check Template Syntax: Double-check the syntax of your email template to ensure that you’re correctly outputting the HTML content from the Rich Text field. Make sure there are no typos or errors in your template code. Test with Different Email Clients: Test your email template with different email clients to see if the issue persists across multiple platforms. This can help determine if the problem is specific to a particular client or if it’s a broader compatibility issue. Consult Documentation or Support: If you’re using a specific email template system or platform, refer to its documentation or reach out to customer support for guidance. They may have specific instructions or troubleshooting steps for rendering HTML content in email templates. By following these steps, you should be able to identify and resolve the issue with rendering HTML content from Rich Text fields in your email template.