Customizing the Mailer Adapter

The mailer adapter is what emails data submitted through a form to a specified recipient. Setting the various options of the mailer adapter will allow you to customize these emails.

A mailer adapter is automatically created when you add a Form Folder to your site.  To find the mailer adapter, navigate to your form and click on the Contents tab in the green bar.  

When editing the the Mailer Adapter, you will see a drop-down menu with various options (see image below). Customizing these options allows you to configure the mailer adapter to better suit your needs.

Overrides

 

Specify Who Will Receive the Form Submission Emails

You'll need to specify who will receive the data when a form is submitted

  1. Edit the Mailer adapter and ensure you are on the Default option/tab.
  2. List the name of the recipient in the Recipient's Full Name field.
  3. List the recipients email address in the Recipient's E-mail Address field.
  4. If you wish a copy of the form to be sent to additional recipients you can enter their email address under the Addressing option/tab. You can add as many CC Recipients and BCC Recipients e-mails as you like, just separate them with commas.

Customize the 'From' Address

You'll want to see who the form submission is coming from.  To do this, 

  1. Edit the mailer adapter
  2. Go to the Overrides option/tab.
  3. Paste the following line of code in the Sender Expression field:
    request/form/replyto

    Note: If the email field on your form has a short name other than replyto, you will need to modify the above code to reflect the short name that you assigned.  We also recommend making the email field required if you are using this method.

If you have a form in which you are not requesting the submitters email address, then you will need to add your (or an alternate) email address.

  1. Edit the mailer adapter.
  2. Go to the Overrides option/tab.
  3. Paste the following line of code in the Sender Expressionfield: 
    string:your@email.address

    Substitute the desired 'From' email address in place of your@email.address in the above code.

 

Default Subject Line

By default, your form will use the Subject field (included in the default form) as the Subject line when it sends emails. If you've deleted the Subject field, the default Subject line will be Form Submission.

 

Create a Custom Subject Line

You can also specify a static (unchanging) subject line, such as “Request For Information,” "Thank you for registering" or “Web Site Feedback.” The recipient of the form submissions will see this same subject line for every email that is generated by the form. To set a custom subject line

  1. Delete the Subject input field that comes by default with all forms
  2. Edit your Mailer Adapter and select the Message option/tab.
  3. In the Subject field, enter the desired Subject line.
  4. Select None from the Extract Subject From field.
  5. Click the Save button at the bottom of the page.

MailerAdapterSubjectLine.png

Use a Field as a Custom Subject Line

Alternatively, you may extract a subject from an existing field in the form. You would use this, for example, if you wanted the subject line of every email generated by the form to be the name of the person submitting the form. Another example is if the user is selecting a certain workshop from a list on your form, the title of the workshop could be used as the Subject line, as a reminder of which workshop they registered for (e.g., "Participatory Research Approaches Workshop").

  1. Edit your Mailer Adapter and select the Message option/tab.
  2. Under Extract Subject From, choose the desired field.
  3. Save at the bottom of the page.

Subject Extract

Use a Field Combined with Static Text for a Custom Subject Line

You can also combine some static text with dynamic content from an existing field as the email subject line. In the Overrides tab of the Mailer adapter, paste the following line of code into the Subject Expression field:

    1. Edit your Mailer Adapter and select the Overrides tab.
    2. Under Subject Expression, paste the following line of code:
python:'Web Site Feedback From ' + request.get('my-field-id', 'default-value')
  1. Change 'Web Site Feedback From' to your desired string of text. Note that you should retain a space at the end of the phrase, if you wish for there to be a space between your custom text and the dynamic text.
  2. Set 'my-field-id' to the Short Name of the field from which you want to extract dynamic content
  3. Change 'default-value' to some text of your choosing that will be used if no input is given for the 'my-field-id' field. If you used a Name field as the dynamic component then the subject line would then read 'Web Site Feedback From Michael Smith'. If a user submitted a form without filling out the Name field and you set the default-value as 'Friend', then the subject line would then read 'Web Site Feedback From Friend'.
  4. Save at the bottom of the page.

[top]

Customized Redirect after Submission

The Overrides tab of a form folder (see image below) holds coded instructions for actions the form can perform upon submission. The most common action to add to a form is a customized redirect.

Form Overrides

By default, when a user finishes filling out your form and submits it, they are redirected to a "Thank You" page, with a confirmation of their form responses, and little else. You may wish to redirect them elsewhere, instead (ex., your homepage).

    1. Edit the form folder and select the Overrides tab
    2. In the Custom Success Action field, paste the following line of code:
redirect_to:string:http://www.example.com

Substitute the desired web address in place of http://www.example.com.

Send an Email to the Form Submitter

By default, the Mailer Adapter will only send email to the email address(es) that you specified when setting up the mailer adapter (see above). However, a second mailer adapter can be added so a courtesy copy of the form can also be sent to the person submitting the form.  In order for this to work you must have a field on your form requesting the email address of the person filling out the form. By default, when you create a new Form Folder, an email field with the short name of replyto is automatically included. If you rename this field, be sure to take note of the new short name. You will need this information to set up the mailer adapter.

Icon Idea If you have deleted the E-Mail Address field, re-add one now:

  1. Select add new... -> string field.
  2. In the Field Label field, type E-Mail Address (or any other text indicating that this field requires an email address).
  3. From the options you see below, put a check next to Required, and select Is an E-Mail Address from the Validator field.
  4. Save at the bottom of the page.
  5. Rename the short name of your E-Mail Address field to replyto
  1. Add a Mailer Adapter to the form folder.
  2. Edit the Mailer Adapter and click on the Overrides tab.
  3. Paste the following code into the Recipient Expression field:
    request/form/replyto
  4. If the email field on your form has a short name other than replyto, you will need to modify the above code to reflect the short name that you assigned.