You are here: Home / Documentation / How To's / How to create a conditional mailer adapter

How to create a conditional mailer adapter

by ledwell published May 28, 2015 08:55 AM, last modified Aug 16, 2016 10:50 AM
Need a plone form that contains selectable email addresses

I'd love to take credit for this but really this was pointed out to me by Kim Nguyen. I'm just documenting it so I don't forget how to do it later :). Oh and a shout out to Steve McMahon who created PFG to begin with (dude is awesome) :).

conditionalMailerAdapterCheckboxesImagine wanting a form that would have a set of checkboxes with email address, departments or people next to those checkboxes. Your guests would fill out the form and choose which of those email addresses or names that they want the form to go to. The form would be sent to the owner of the form and CC'd to whom ever the guest chose via those checkboxes.

This solution requires one "Mailer Adapter" for every email checkbox field

This was tested with: Plone 4.2.3


  • Create the ploneformgen form
  • Choose the "quick edit" tab and choose the "edit (pencil)" icon
  • Set the main "Mailer Adapter" to whom ever should get this email. You can also set the CC option under "addressing" if needed


  • Create a "checkbox field"
  • Name that field something easy to remember like "cc-joe-smith". This field will be the first conditional email address


  • While in "quickedit" add a new "Mailer Adapter" under "Actions"
  • Name it something clear like "Mailer-to-Joes-Department"
  • In the "Recipient's e-mail address" dialouge add the person email address. You can also set the CC option under "addressing" if needed
  • Choose the drop down and choose "overrides"
  • Under "Execution Condition" copy and paste the following expression. Note that "cc-joe-smith" is the same ID as you used for the email field.

  • python: request.form['cc-joe-smith'] 


Thats just about all you need. Repeat this process for every additional email address you want to add. Make sure that the mailer adapter(s) are checked on under the "Quickedit" tab.