Personal tools
You are here: Home Documentation Tutorials Customizing PloneFormGen Customize the Subject Line with Dynamic Values
Document Actions

Customize the Subject Line with Dynamic Values

By adding an override in the Mailer Adapter you can dynamically generate a subject line for your email.

You can define an email subject line in PloneFormGen's Mailer Adapter under the Message tab in one of two ways. You can either set a static subject in the Subject field, or you can extract a subject from any available string field in your form using the Extract Subject From drop-down menu.

However, you can also create a mail merge-like subject line that combines a piece of static text with a piece of dynamic text by using the Overrides tab of the Mailer Adapter. In the Overrides tab, notice the Subject Expression field. Paste the following line of code in this field:

python:'Thank you ' + request.get('my-field-id', 'default-value')

Where 'Thank you' is a string of text of your choosing, 'my-field-id' is the Short Name of the field from which you want to extract dynamic content, and 'default-value' is a string of text of your choosing used if no input is given for the 'my-field-id' field.

Let's consider an example. Let's say you used a First Name field for the dynamic component, and you used 'Friend' for the default-value. The subject line would then become:

  • Thank you George (with an input of George)
  • Thank you Friend (with no input)

 

 

 
by samk last modified 2008-11-10 14:05 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