Design message content using the text-based code editor

 

Updated: November 1, 2016

Applies To: Dynamics Marketing

System_CAPS_importantImportant

Microsoft Dynamics Marketing is scheduled to be retired on May 15, 2018. After that date the service will no longer be available. Please plan accordingly. For details, see the blog post Microsoft Dynamics Marketing service will be discontinued, and learn what’s coming next.

Use the text-based code editor to design your marketing emails using pure HTML code. This editor provides syntax coding and code-completion features, and also provides shortcuts for adding Microsoft Dynamics Marketing email plug-ins, managed links (such as offers, landing pages, and webinars), and contact-field values (such as first, name, last name, and address). You may also use this editor to quickly copy and paste finished HTML text developed in another program.

System_CAPS_tipTip

One way to get a head start on your coding is to start by using the graphical editor to set up the basic layout; format text; and place plugins, graphics, and managed links (like offers, webinars, and landing pages). When your layout is approximately as you want it, go to the View HTML Content top-level tab Graphical email editor View HTML Content tab to copy the generated HTML, which you can now edit using your favorite text editor, and then paste it into a new message that uses the code editor.

More information: Create or view email marketing messages, Design message content using the graphical editor

To use the code editor, you must create a marketing email based on a template that is pre-programmed to use it. That means either starting with the “blank email with HTML editor” template or with a predesigned template that was created with the code editor. The editor is available from the Edit Content top-level tab of the maintain-email page for a given message.

For complete details about how to create a marketing email, apply a template, and use the top-level tabs, see Create or view email marketing messages.

The code-editor interface is divided into two panes: the code pane and the Properties pane.

The code pane is the large area on the left. This is where you will type or paste your code. This editor provides syntax coloring and code-completion features. Your code should be a complete, valid HTML email, including a doctype, <html>, <head>, <body>, etc.

The Properties pane is to the right of the code pane. The following settings are available here:

  • From: Establishes the “from” address for the email, based either on an existing contact in the databases or on an expression; this is required for the email and can also strongly affect the open rate for the message, because contacts will see this and consider it before deciding whether or not to open it. Your message will fail validation and not be sent unless you have a valid setting here. To specify a contact from the database, select the Contact radio button, and then begin typing the contact name in the field; type-ahead suggestions are provided. To use an expression (using Razor syntax), click the Expression button and enter your expression in the field. Often, your Expression code will include field values; you can see examples of these by making selections from the Insert Field drop-down list.

  • Subject: Establishes the “subject” line for the email. Like the “from” address, this is required for the email and can also strongly affect the open rate for the message. Your message will fail validation and not be sent unless you have a valid setting here.

  • Content Language: Choose the language you are using to write your message. If your message body includes one or more dynamic field values set up as categories (drop-down lists), then these can include translations for each available value. The language you choose here will determine which language is used for category values such as these. One field where this is likely to be useful is @Contact.Salutation, which may provide options for “Dear Ms. ”, “Dear Mr. ”, and “Dear Dr. ”, with translations of each in several languages. More information: Create custom drop-down values and folders

System_CAPS_tipTip

For more information about using these fields, including tips and examples for using expressions and field values, see Design message content using the graphical editor.

The best way to include graphics in your marketing emails is to add them from the Dynamics Marketing digital-asset-management system. This provides a central place for you to store, approve, and manage your images while also introducing many performance improvements. To position an image in your code:

  1. Place your cursor at the position in your code where you want to place an image.

  2. Click the Insert Image button HTML code editor Insert Image button at the top of the text editor.

  3. When the file browser window opens, use it to find and select the image you need. You can also add new images to the system from here. You can only choose images saved in the Email Marketing folder, because these are available publicly and are also optimized for email delivery. More information: Find, organize, and upload files in the file browser

For more information about using images in marketing emails, see Create or view email marketing messages

Above the coding area are two drop-down lists that will help you integrate special Microsoft Dynamics Marketing features into your code. Use them as follows:

  • Insert Plug-In: Places a plug-in placeholder at the cursor position. The placeholder will be replaced with the plug-in code when the message is sent. Microsoft Dynamics Marketing provides several types of plug-ins, which will make your work more convenient. Some of these are required, such as a subscription center and physical address. Others are optional, such as forward-to-a-friend, view-as-webpage, and one-click subscribes. When you place a subscription center or forward-to-a-friend plugin, then you must specify the plug-in on the Summary top-level tab for your message, where you can change these at any time.

  • Insert Field: Places a short piece of code that will be replaced with text drawn from each individual recipient’s contact record. Use this to add a personal greeting and to add other personalized information.

Dynamics Marketing provides several types of managed links, including landing pages, offers, and webinars. These types of links redirect through Dynamics Marketing, which logs the click and provides various types of extra features, depending on the link type. The graphical email editor includes a drop-down list for placing these types of links in a message, but the text editor does not. You can still use these types of links, but you need to add them manually by finding the right URLs and including them in your HTML code.

  • Offers: Go to Marketing Execution > Campaign Management > Campaigns and then find or create the offer you want to use. After you have saved an offer at least once, you can find the URL for it in the Content section of the Offer maintenance page. More information: Create offers and track the response

  • Landing Pages: Go to Marketing Execution > Lead Management > Landing Pages and then find or create the landing page you want to use. After you have saved a landing page at least once, you can find the URL for it at the top of the Content section of the Landing Page maintenance page. If have set up more than one language for your landing page, then there is a different URL for each language. More information: Create and customize landing pages

  • Webinars: After you have set up your event and webinar registration item, create a temporary marketing email message that uses the graphical editor (for example, by choosing the “Blank email” template). Configure all of the required settings and include a link to your webinar in the message content. Finally, send the message to yourself and when you receive it, inspect the source to find the webinar URL. Don’t use test send, as this will not deliver the correct webinar URL. You can also use this technique to find URLs for offers and landing pages. More information: Set up a webinar, send invites and track responses, Design message content using the graphical editor

You can add any number of links to your message by using common HTML tags and attributes. But be aware that when you send or activate your message, Dynamics Marketing will parse it for standard links and replace the target for each of them with a shortened URL that targets your Dynamics Marketing email-marketing server instead of the address you specified. When a contact clicks one of these links, Dynamics Marketing logs the click and immediately forwards the contact to the address you originally specified. This is what makes click tracking possible. The redirect link generated by Dynamics Marketing uses a shortened format, so even if your original link features a very long URL and path, the link generated by Dynamics Marketing will be relatively short. When you send or activate your message, you will see the list of redirected links on the Summary page for the message (see also Create or view email marketing messages).

You can design your messages so that the content changes based on the segment of each given contact. The procedure for doing this with the text editor is essentially the same as for the graphical editor, as described in Design message content using the graphical editor.

A few special characters (such as: [ ] @ { [- -] ) trigger post-processing on your email text. If this is not what you have in mind, then you must escape and/or redesign the way you use these characters in a few, very specific, situations. These apply to both the graphical and code editors. For complete details, see Design message content using the graphical editor.

You can freely insert razor expressions into your hyperlinks, image links, and other HTML tags and attributes so that they include dynamic values drawn from the recipient’s contact record. The syntax is the same as that shown when you add a field value into body text using the drop-down list (@EntityName.FieldName). For example:

<a href="https://contoso.com/page.html?Name=@Contact.FirstName&PromotionCode=@Contact.LastName">Link 1</a>
<img src="@Contact.CustomFields.UdField1" />
Show: