Using Code Blocks to Insert Custom HTML

Using Code Blocks to Insert Custom HTML

Code blocks allow you to insert custom HTML code into your email designs, giving you greater flexibility for custom content, real-time personalization, and third-party integrations. This feature is ideal for marketers who need more control over specific elements that are not available in the standard drag-and-drop tools.

Use a code block when you want to embed custom features directly into your emails, such as real-time ads.

How to Add a Code Block

  1. In the email editor, drag the Code element to an empty cell in your canvas.

  2. Click on the cell to open a text box on the right-hand panel.

  3. Paste your custom HTML code into the text box provided.

  4. Preview your email to ensure the custom content appears correctly.

Tip: Save your work frequently when adding custom HTML to prevent any loss of edits or accidental formatting errors.

Example Use Cases

  • Display a partner advertisement by pasting ad tags into the Code block.

    InfoWhat is an ad tag? An ad tag (also known as a creative tag or placement tag) is a snippet of HTML code inserted into an email. It sends a request to an ad server to retrieve and display an ad within the email layout.

  • Show real-time personalized content such as live weather widgets, dynamic offers, or inventory updates.

  • Embed geo-targeted offers based on the subscriber’s location.

Important Notes on Using Code Blocks

  • Iframe and Script tags are not supported: Iframe and script tags will be stripped out after saving or moving forward in the workflow because most email clients block these for security reasons.

  • Editing limitations: Code blocks cannot be edited using the standard drag-and-drop tools. To modify a Code block, you must update the raw HTML directly in the text panel.

Best Practices for Using Code Blocks

  • Always use inline CSS styles for better compatibility across email clients.

  • Avoid JavaScript and iframes, as these elements are typically blocked or stripped by email providers.

  • Keep your code lightweight to ensure faster load times and better deliverability.

  • Thoroughly test your email across multiple devices and clients before sending.

  • Validate your HTML code using online validators to catch errors early.

Troubleshooting Tips

If your Code block content does not appear correctly:

  • Review the HTML code for syntax errors or missing tags.

  • Confirm that the elements used are email-friendly and widely supported.

  • Test with a simplified version of the code to isolate issues.

  • Contact our Support team if you need additional help.

Need Help?

If you have any questions about using Code blocks or customizing your email designs, our Support team is happy to assist you.
Reach out by emailing support@delivra.com.


    • Related Articles

    • How do I export my form code?

      You created a form and now you need to export the HTML to incorporate on your website. There are two common ways to export this code from your account. Export form HTML code from the Form library Navigate to the Assets Dashboard and click "Forms" ...
    • Insert current date and time

      At times you may need to merge in the current date into content files. This may be due to transactional or purchase interactions with your contacts. In this context, "current" refers to date/time the email is received. There are several different ...
    • Create a subscribe form

      What is a subscribe form? Forms are used to collect subscriber information. When the form is submitted, it will add a new contact to your Delivra account or update an existing contact with that email address in your account. Typically subscribe forms ...
    • Barcodes and QR codes

      QR codes QR codes are commonly used in email marketing for transactional emails for ticketing & event admission. With our drag-and-drop email editor, you can easily insert a QR code into your email design to create a personalized experience for your ...
    • How do I use a custom stylesheet with my email design?

      Using External Stylesheets for Mobile Email Design For designers comfortable working with CSS, Delivra offers the ability to upload and apply external stylesheets to control the mobile styling of emails. This gives you full flexibility over ...