Create an Email in Code View in Marketing Cloud Next

In code view, view and edit message HTML and CSS for custom control over your email design. Also, advanced users can use Handlebars templating language to add scripting and conditional logic and perform data lookups. As you author, code view provides syntax validation, inline coding assistance, and search. Preview and test the email and publish it for use with a campaign. To change a published email or prevent it from sending in a campaign, you can unpublish it.

Required Editions

View supported editions.

User Permissions Needed
To create or edit content:

Marketing Cloud Manager permission set

AND

any CMS workspace contributor role

To publish or unpublish content:

Marketing Cloud Manager permission set

AND

a CMS workspace contributor role of content admin or content manager

Create an Email in Code View

  1. Create or open an email for editing.
    • From the Campaigns tab, open a campaign or create one. Then, on the campaign record, next to the email that you want to work with, click Edit.
    • From the Content tab, open a marketing workspace, and open an email for editing.
    • From the Content tab, to create an email, click Add | Content | Email. Then, select Create with HTML.
    • From a flow, open a Send Email Message element, and edit the related email.
  2. In the editor, give your email a title for internal use.
  3. In the Settings tab, select an optional brand and add a subject for your message.
  4. Set the Message Purpose to Promotional or Transactional.
  5. Add content to your email.
  6. If you’re converting an email that is component-based, click the Code View icon code icon that appears in the main toolbar of the editorat the top of the builder to preview the HTML in the Code View tab. Then, click Convert to Code and make your edits.
    After you convert an email to code, you can’t use drag-and-drop components or apply styling from the Style tab. The conversion also removes dynamic content, including repeaters, conditional logic, and content variants from an email. You can’t undo this action.
  7. To attach a document to the email, in the Settings tab under File Attachment, click Add Document, and select a PDF file (up to 5 MB) from Salesforce CMS.
  8. To let recipients open a browser-rendered version of the email when their email client breaks the layout or blocks images, add a View as Web Page link.
    1. Place your pointer where you want the link to appear, such as a banner at the top of the email, and add the link.
    2. To personalize the link, click Add Merge Field.
      This example adds a centered "View in Browser" link that resolves to the View as Web Page URL.
      <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td align="center" style="font-family: Arial, sans-serif; font-size: 13px; color: #333333; padding: 12px 20px;">
      <a href="{$link.ViewAsWebPageUrl}" style="color: #0066cc; text-decoration: underline;">View in Browser</a>
          </td>
        </tr>
      </table>
    The link becomes active when the email is sent, and works for 90 days after the send. The web page version reflects the published version of the email. If you edit the email after it’s sent, recipients still see the version that was published when the email was sent. Personalized values, however, are re-rendered against the recipient’s current profile each time the link is opened.
    Note
    Note The View as Web Page feature is available starting in November 2026.
  9. To add a placeholder for more personalized data, click Add Merge Field again.
    Depending on the data sources added to the email, you can insert data graph attributes, saved expressions for data graph attributes, recipient unified profile values, offers, or event data, such as order confirmations. For more information, see Personalize Content with Merge Fields in Marketing Cloud Next
  10. In promotional emails, to comply with consent and privacy regulations include your organization’s address and an opt-out link.
  11. Save your work.

To make an email available to send in a campaign, publish it. You can’t activate a campaign flow that contains an email until the email is published.

Create a Plain Text Version of an Email

Add a plain text version of your email to make sure that it can be delivered to recipients whose email clients don't render HTML. Plain text emails don't support formatting, font styles, colors, or inline images. When you manually edit the plain text version, it's no longer in sync with the original version of the email. Also, future changes to the original version aren't included in the plain text version.

  1. In the email editor, click the Plain Text View icon in the main toolbar.
  2. Click Edit.
  3. To add a placeholder for personalized data, click Add Merge Field.
  4. To discard your plain text edits and restore the content to the original version, click Restore.
  5. Save your work.

Unpublish an Email

To change your email back to draft status and prevent it from sending in an email campaign, unpublish your email.

  1. From your marketing workspace, open the email that you want to unpublish.
    • From the content detail page, click Unpublish.
    • When you’re editing your email, from the main toolbar, click Unpublish.
  2. Review the list of related flows and content and determine if any other changes are needed.
  3. To unpublish the email immediately, click Unpublish Now.
  4. To unpublish the email later, click Schedule Unpublish, and schedule a date and time to unpublish it.