---
schema_version: "1"
id: 268186593f3f4e76cc283e06e4f4a2d8ddef1b799777211c6566f77c5214c413
title: Create an Email in Code View in Marketing Cloud Next
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/mktg_content_email_html_create.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.mktg_content_email_html_create.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: ed2e0c5d9db52ce15c9fce1d6e82b2c5909981609fab2946fcbcd44a965f462a
description: 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.
products:
  - Marketing
release: "264"
---
# 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](https://help.salesforce.com/s/articleView?id=mktg.mktg_editions.htm&release=264.0.0&type=5 "Marketing Cloud Next is available in Growth and Advanced editions, and requires Salesforce Enterprise or Unlimited editions. Some features are limited by edition or purchased add-on. All functionality is available in Lightning Experience only.").

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d42976e52">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d42976e52 ">To create or edit content:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d42976e52 ">
              <p>Marketing Cloud Manager permission set </p>
              <p>AND</p>
              <p style="margin-bottom:0;">any CMS workspace contributor
                role</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d42976e52 ">To publish or unpublish content:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d42976e52 ">
              <p>Marketing Cloud Manager permission set </p>
              <p>AND</p>
              <p style="margin-bottom:0;">a CMS workspace contributor role
                of content admin or content manager</p>
            </td>

          </tr>
        </tbody>
      </table>

## 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 editor](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-mktg-mktg_all-264-0-0-production-enus/e92be4e1-4bef-47a5-a11d-95f4ea1f7d7a/mktg_all/images/mktg_email_code_view_icon.png)at 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](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-mktg-mktg_all-264-0-0-production-enus/e92be4e1-4bef-47a5-a11d-95f4ea1f7d7a/images/icon_note.png)
    
    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](https://help.salesforce.com/s/articleView?id=mktg.mktg_content_personalization_merge_fields.htm&release=264.0.0&type=5 "Use merge fields to personalize your marketing content with customer data. For example, personalize an email with your customer's name or customize a landing page with products you know they're interested in.")
10. In promotional emails, to comply with consent and privacy regulations [include your organization’s address and an opt-out link](https://help.salesforce.com/s/articleView?id=mktg.mktg_content_email_canspam.htm&release=264.0.0&type=5 "To comply with privacy and consent laws and regulations, including the U.S. CAN-SPAM Act, add an opt-out link and a physical mailing address to emails. Use the corresponding merge fields in text-based components in the email body.").
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.

#### See Also

- [Personalize Content with Merge Fields in Marketing Cloud Next](https://help.salesforce.com/s/articleView?id=mktg.mktg_content_personalization_merge_fields.htm&release=264.0.0&type=5 "Use merge fields to personalize your marketing content with customer data. For example, personalize an email with your customer's name or customize a landing page with products you know they're interested in.")
- [Manage Data Sources for Personalizing Content](https://help.salesforce.com/s/articleView?id=mktg.mktg_content_personalization_data_sources.htm&release=264.0.0&type=5 "To embed personalized data in your marketing content, add a data source. A data source represents an object or element from your org that contains fields and data. After you select a data source, its fields and attributes are available to use in merge fields, expressions, repeater components, and dynamic content.")
- [_Salesforce Developers_: Handlebars for Marketing Cloud Next](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-references/mcn-handlebars-about.html)