Personal tools
You are here: Home Documentation Tutorials Customizing PloneFormGen Customizing the Mailer Template
Document Actions

Customizing the Mailer Template

How to customize the mailer adapter template to include your own message and how to include mail merge-like dynamic content.

mailer-adapter-template.gif

If you wish to customize the mailer adapter, you must have some familiarity with HTML, and TALES preferably. To get started, edit the Mailer Adapter and click on the Template tab to see the email template.

You should see a chunk on HTML and TALES similar to the screen shot to the left. The default template is designed to grab all three plain-text fields found in the Message tab, and display all the form data that the site visitor submitted. If you do not put any text into the Message fields (prepend, append, and signature), no text will render so it is not necessary generally to remove those lines of code.

However, if you do not want the form data to be part of your email message, you can remove the definition list that renders this information. The code in question is the following:

    <dl>
        <tal:block repeat="field options/wrappedFields">
            <dt tal:content="field/fgField/widget/label" />
            <dd tal:content="structure python:field.htmlValue(request)" />
        </tal:block>
    </dl>

Simply highlight and remove this block of HTML and you're all set. Now you can enter your own HTML and TALES code to create a customized email message. Use only non-deprecated HTML tags to format your message.

If you wish to include dynamic content in the template you must be familiar with TALES. Below is an example of a TALES expression that grabs the first-name field data and puts it into the email template.

<tal:block tal:content="python:request.form.get('first-name', 'Supporter')"/>

'first-name' is the shortname of the First Name string field. 'Supporter' is the default value that will be used if no First Name data is submitted. For required fields, it's probably not necessary to define a default value.

 

 

 
by samk last modified 2008-11-10 12:02 All content on this site is licensed under a Creative Commons License.
Still Stumped?
If you've still got questions about Plone, here are your best bets for finding out more:
 

All content in this site distributed under the Creative Commons "Attribution-NonCommercial-ShareAlike" license unless otherwise noted.

Powered by Plone CMS, the Open Source Content Management System