Documentation Center

Separating HTML format and plain-text format

Outbound E-mail lets its users send plain-text e-mail as well as HTML e-mail.

About this task

Some e-mail recipients do not have access to an e-mail client that can handle HTML-formatted e-mail, and prefer to receive plain-text e-mail. This format preference is stored in a Contact’s Details.

Although you can use the Generate Plain Text E-mail Template Building Block to generate a plain-text e-mail from your entire HTML output (using XSLT), it is recommended to create separate Dreamweaver Templates to handle text versions and HTML versions of your e-mail.

To cater for text and HTML versions of Component Template output:

  • In your Compound Page Template, use the SetEmailType() method in your Dreamweaver Template to get text/HTML versions of the e-mail.
  • In your Compound Component Template, add separate Dreamweaver Templates to render the text/HTML versions of the Component Presentations and the Set Output Item By Email Mode Template Building Block to add these versions as output elements.
Compound Page Template
Your Compound Page Template should contain:
  1. A Dreamweaver Template that loops over the Component Presentations to get the rendered HTML version of your e-mail:
    <html> 
    	<!-- TemplateBeginRepeat name="Components" -->
    		@@SetEmailType('html')@@ 
    		@@RenderComponentPresentation()@@ 
    	<!-- TemplateEndRepeat --> 
    </html> 
  2. A Dreamweaver Template that loops over the Component Presentations to get the rendered Text version of your e-mail:
    <!-- TemplateBeginRepeat name="Components" --> 
    	@@SetEmailType('text')@@
    	@@RenderComponentPresentation()@@ 
    <!-- TemplateEndRepeat -->
  3. The Outbound Email Post Processing Template Building Block to add the rendered HTML and Text versions to the output.
Compound Component Template
Your Compound Component Template should contain:
  1. A Dreamweaver Template to render the HTML version of your Component Presentation (e-mail text).
  2. A Dreamweaver Template to render the Text version of your Component Presentation (e-mail text).
  3. The Set Output Item By Email Mode Template Building Block adds an HTML or Text version of the Component Presentation as output elements depending on whether the Dreamweaver SetEmailType() is set to html or text.