Customize the Subject Line with Dynamic Values
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)
