E-mail-specific customizations
CSS-To-Inline
In some email clients, CSS instructions must be attached directly to the HTML tag for error-free display (i.e. inline). When using CSS-To-Inline, CSS properties are automatically written as inline styles into the corresponding tag during rendering.
To activate the function, the attribute transform="true" must be added to the desired <style> tag:
Example: CSS instructions
- <style type="text/css" transform="true">
- .font {
- font-family: Open Sans, Arial, sans-serif;
- }
- </style>
During rendering, these properties are written as inline style into the tag with the corresponding class.
Template Source Code
- <table cellspacing="0" cellpadding="0" width="640" align="center">
- <tr>
- <td class="font">Das ist der Text.</td>
- </tr>
- </table>
Output Source Code
- <table cellspacing="0" cellpadding="0" width="640" align="center">
- <tr>
- <td class="font" style="font-family: Open Sans, Arial, sans-serif;">Das ist der Text.</td>
- </tr>
- </table>
CSS-To-Attribute
When using CSS-To-Attribute, CSS properties specified in the header are converted into appropriate HTML attributes during rendering and added to the HTML tag.
To activate the function, the comment <!-- cssToAttribute --> must be inserted within <head></head>:
Example: CSS instructions
- <head>
- <!-- cssToAttribute -->
- <style type="text/css" transform="true">
- .spacer {
- height: 25px;
- }
- </style>
- </head>
Template Source Code
- <table cellspacing="0" cellpadding="0" width="640" align="center">
- <tr>
- <td class="spacer"></td>
- </tr>
- </table>
Output Source Code
- <table cellspacing="0" cellpadding="0" width="640" align="center">
- <tr>
- <td class="spacer" style="height: 25px;" heigth="25"></td>
- </tr>
- </table>
Supported Attributes
CSS Instruction | Generated Attribute |
background-image: url("foo.gif") | |
background-color: #cccccc; | |
width: 200px; | |
height: 200px; | |
text-align: left; | align="left"
|
Text Part
A text part is important to ensure mailings are not classified as spam, even if it is rarely displayed nowadays. Generally, the MWML structure of the HTML part can be used, but without the HTML tags.
- Indentations with spaces or tabs should be removed, as these would otherwise be visible.
- All line breaks are visible and should therefore only be used where they are desired.
- Many attributes such as label or default texts can be omitted in the text part.
Example
- View email in browser: [VIEWONLINE /]
- ===
- [CONTAINER name='header'][ELEMENT name='headerbanner' default='true']
- [INPUT type='a_img' name='image'][BLOCK name='caption']
- [INPUT type='span' name='text' required='true' /][/BLOCK][/ELEMENT][ELEMENT name='editorial' default='true'][CONTAINER name='editorial'][ELEMENT name='headline' default='true']
- [INPUT name='headline' /][/ELEMENT][ELEMENT name='text' default='true']
- [INPUT name='text' label='Text' /][/ELEMENT][ELEMENT name='button' default='true']
- [INPUT type='a' name='button' required='true' /][/ELEMENT][/CONTAINER][/ELEMENT][/CONTAINER][CONTAINER name='main'][ELEMENT name='teaser-article' default='true']
- [INPUT type='img' name='image' /][CONTAINER name='teaser-article'][ELEMENT name='headline' default='true']
- [INPUT name='text' /][/ELEMENT][ELEMENT name='headline2']
- [INPUT name='text' /][/ELEMENT][ELEMENT name='text' default='true']
- [INPUT name='text' /][/ELEMENT][ELEMENT name='button' default='true']
- [INPUT type='a' name='button' required='true'][/ELEMENT][/CONTAINER][/ELEMENT][/CONTAINER]
- ===
- [CONTAINER name='footer']...[/CONTAINER]
Hide Content in Browser View
Example: Hide link to online view in browser
- [if-param module='viewonline' render='false']
- <a href="[VIEWONLINE /]">View browser version</a>
- [/if-param]
In the next step, learn how to add an automatic table of contents: