I have a Freeform form that is a request for information. There are checkboxes in the form for various locations on the site. I want to dynamically send emails based on the checkboxes that are checked. Is that possible?

It is poorly written the way it is now. After the form is submitted, the coder added raw php to the response template to parse the locations and build a string for the "to" variable for the dynamic recipients. The mail was sent using the php "mail" command. They also put it inside a freeform entries tag pair. What happens is sometimes the mail does not send at all, and sometimes it sends duplicates, which are also sent at different times.

Any suggestions either with or without Expression Engine?

2 Answers 2


Freeform Pro has it's "Composer" form editing tool that includes a field for dynamic recipients. Otherwise if you're using hard coded forms (or the free version of Freeform) you can use the recipients variables - https://solspace.com/docs/freeform/form/#freeform_recipient_value1 - that would also negate the need for PHP in templates.


Here is what I did. I create a select box in the form populated with channel data and using custom field for optn text and entry_id as option value. Then created an EE extension that listens for freeform_module_admin_notification hook. Then use the entry_id value from the form to find the email address from channel data table. Then pass that email address into $vars['recipients']. Then freeform sends an email to any email address in the $vars['recipients'] array.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.