Forums

email form that meets certain criteria

mcole 13 May, 2013
I have a form that is working perfectly. On submit it is being emailed to two different recipients and working exactly as I set it up.
The final field in my form is simply checkbox. Is it possible to send email if that box is checked and not send it if the box is cleared to the second recipient only?
So the first recipient gets all submitted forms, the second recipient gets only the forms with the final field checked.

Thank you...

Matt
GreyHead 14 May, 2013
Hi Matt,

The simplest way would be to use a Dynamic CC for the second user and to set or remove the value of this parameter depending on the checkbox with code in a Custom Code action before the Email action:
<?php
  $form->data['cc-email'] = '';
if ( isset($form->data['checkbox_name']) && $form->data['checkbox_name'] ) {
  $form->data['cc_email'] = 'some_email@address.com';
}
?>
then put {cc_email} in the Dynamic CC box.
Bob

PS You can also use my Email [GH] action or my Event Switcher [GH] to send emails conditionally.
This topic is locked and no more replies can be posted.