Use the Code Editor to create a template, edit a SendGrid template, or build a campaign with your own custom HTML. With helpful features like preview, tag completion, and error flagging, you can confidently edit your HTML.
From the left-hand navigation, select Marketing, and then click Campaigns.
Click Create Campaign. To create a campaign using an existing campaign, find the campaign you want to use and click the action cog next to the campaign and then select Edit or Duplicate.
Select the template that you want to use for your campaign. You can select a Blank Template, a custom template that you have already created, or one of SendGrid’s pre-built templates. For more information, see Working With Templates.
Select Code Editor, and then click Continue.
If you have already built the HTML that you want to use in another application, copy and paste that code directly into the content area of the code editor. You can also write the HTML for your campaign or template directly in the code editor. The code editor has predictive text completion, color-coded syntax highlighting, and detailed error messages.
Preview your campaign or template by clicking the Preview button. You can toggle between a preview of how your campaign or template will appear on a recipient’s desktop and mobile phone by clicking either the desktop or mobile phone icons above the content area. You can also view a plain-text version of your campaign or template by clicking the T icon. When in this preview mode, you can edit the plain text content of your campaign or template by clicking the Edit Plain Text button.
Once you create a new campaign or template in the Code Editor, you cannot switch to the Design Editor.
Select the Images tab, and click Manage Image Library. This opens a modal window where you can upload images to your image library.
Select the image you want from your image library. This takes you to the Image Details tab.
Copy the URL in the Image Source URL tab by clicking Copy URL.
Paste this URL in the image source tag in your campaign or template’s HTML. For example:
<img src="your image URL here">
Substitution tags allow you to easily generate dynamic content for each recipient on your contact list. When you send to a list of recipients you can specify substitution tags specific to each recipient.
To add a substitution tag to your campaign:
Navigate to the Tags tab.
Locate the tag you want to add to your campaign and click the copy icon.
Paste the tag into the module.
You can add the following substitution tags to your marketing campaign:
||The email address of the recipient||Personalization|
||The first name of the recipient||Personalization|
||The last name of the recipient||Personalization|
||The name of the sender selected when sending your campaign||Sender Identity|
||The city on record for the sender selected when sending your campaign||Sender Identity|
||The state on record for the sender selected when sending your campaign||Sender Identity|
||The zip code on record for the sender selected when sending your campaign||Sender Identity|
||This tag will be replaced with a link allowing your recipient to be added to theunsubscribe group selected when sending your campaign.||Unsubscribe|
||This tag will be replaced with a link allowing your recipients to opt into or out of the various emailunsubscribe groupsyou offer.||Unsubscribe|
||This tag will be replaced with a link allowing your recipients to view your campaign content directly within their web browser.||Weblink|
For contacts with no entry in a custom field, the substitution tag will appear blank. To set a default value, use the following pattern:
[%first_name | Valued Customer%]
To preview your campaign or template, click the Preview button in the upper-left corner.
You can toggle between a mobile and desktop preview mode by clicking either the desktop or mobile phone icons above the content area.
To view a plain text version of your campaign or template, click the T icon. When in this preview mode, you can edit the plain text content of your campaign or template by clicking the Edit Plain Text button.
When previewing a campaign, you will also see a preview of the From name, the Subject, and the preheader text that you have selected.