skip to primary navigationskip to content
 

Mailer Adapter

What it does:

Mails the form input to a specified address. Multiple Mailers can be used to send selected parts of the form input to different recipients.

 

<Edit tab> notes: 

 

Default

Here you set to whom the form data is sent.

Use an appropriate Short Name and Title particularly where there are multiple Mailers present. Enter the appropriate recipient's details. You will be able to CC persons in the Addressing section.

Example: 

 

 

Addressing

Here you set to whom the form data is sent and to whom any response to the output email is sent.

 

Extract Recipient From - here you can choose one field from the form that has an email address as input [e.g. a String Field with Validator set to 'Is an E-Mail Address']. I.e.

Note. The email field doesn't necessary has to appear on the form itself. It can be hidden and populated with a value of your choice.

If you don't select an email field and leave this setting on 'None', the address set in the Default section (see above) will be used.

 

Complete the CC and BCC Recipients boxes as required. 

 

Extract Reply-To From - Any response to the email containing the form data will be sent to the email address designated here. You are only able to select from an email field within the form (can be a hidden field).

 

 

Message

This section manages the content of the email.

Subject - change this to a meaningful term which will be visible in the recipient's mail inbox. E.g. 'July 2014 Maths supervision feedback'.

 

Extract Subject From - If used, this will override the Subject field above. The choice of Subject lines available will be the inputs of any String Fields used on the form.

 

Body (prepended) - Text entered here will appear before the list of fields.

 

Body (appended) - Text entered here will appear after the list of fields.

 

Body (signature) - Text entered here will appear after the email's contents, and by default appears in typewriter font.

 

Include all fields - Select this to automatically add all the form data to the email.

 

Show Responses Here the fields to include/ exclude from the email are specified. If you wish to use this method, you will need to de-select the 'Include all fields' checkbox above.

 

Include Empties - Self-explanatory.

 

 

Template

Here the display of content, within the email being sent to the recipient, can be set up. Knowledge of TAL (Plone's Template Attribute Language) is required.

Example: 

This is the default templating code:

Note that the Body (prepended), Body (appended), and Body (signature) text is included using here/getBody_pre, here/getBody_post, and here/getBody_footer.

Here is an example of a template producing slightly tidier output:

Note. Form inputs are stored in request.form. If you wanted to display a Rich Label field from the form, you would have to use code similar to the following:

<tal:block tal:content="structure context/name-of-label/fgField/default" />

Here fgField is a Plone container for the value of the label field which itself is accessed using 'default'.

Information on using TAL within the Mailer Adapter is skimpy and it is worthwhile playing around with various HTML and TAL coding combinations to achieve your desired effect.

 

 

Encryption

Beyond the scope of this tutorial. If you wish to encrypt the form data please contact .

 

 

Overrides

Subject Expression  - here you can enter a line of code which will override the output email's Subject field (set within the Message section, see above). This feature is slightly more useful than the Extract Subject From feature (see Message section) in that additional text can be added to the Subject as well as including a form field.
Example:
python:'Additional course resources for User (' + request.get('crsid') + ')'



Sender Expression  - code here will override the output email's From field (set within the Addressing section, see above). Use this feature if you wish to include more than an email field's contents or even instead of an email field's contents.



Recipient Expression  - code here will override the output email's To field (set within the Addressing or Default sections, see above). The code must evaluate to an email address only.
Example:
python:{'Yes':'member-admin@cam.ac.uk','No':'visitors-admin@cam.ac.uk'}[request.form.get('isMember', 'No')]



CC Expression code here will override the output email's CC field (set within the Addressing section, see above). The code must evaluate to one or more email addresses only.
Example:
string:${request/form/replyto},${request/form/supervisor-email}



BCC Expression code here will override the output email's BCC field (set within the Addressing section, see above). The code must evaluate to an email address only.



Execution Condition - (python) code placed here is used to determine whether or not (i.e. depending on the form input) this particular Mailer adapter executes. This feature is useful where a number of action adapters exist for a form.

 

 

Settings

This has no useful function for the Mailer Adapter.