Sending email triggered by form submissions is simple! A question we’re often asked is about the ability to send email only to certain people or departments based on what a user inputs into their form. You absolutely can do this! Let’s take a minute and look at how to send conditional email with Ninja Forms!
Sending conditional email requires our Conditional Logic extension. Conditional Logic adds the ability to set conditional statements throughout your form. Adding criteria to send conditional email is just one of the many things you can apply these conditional statements to.
In Ninja Forms 3.0, we’ve moved almost all conditional statements to one centralized control center: the Advanced tab of the form builder. Your email actions, however, have conditional logic options conveniently baked into the action window. Let’s walk through exactly how to set up statements to send conditional email now!
How to Send Conditional Email
You have a Quote Request form pre-made for you when you open Ninja Forms. Let’s use that form as an example for how this can work. Here’s what our form looks like to person filling it out:
Say we want to send an email to the relevant department depending on how the “What services may we assist you with?” question is answered. If Consultation is checked, we want an email to go to the folks at consultation. If Development is checked, we want an email sent to the development people, etc. In short, we want an email sent to each department that gets ticked on this question, and if a department is left unticked, then no email is sent.
Let’s do this!
Step 1: Create an Email Action for Each Department
- Click the Emails and Actions tab in the form builder
- Add one email action for each department (click the little blue circle in the bottom right of your screen to slide open the actions menu window)
- Name each action appropriately so you don’t lose track of who’s who!
Step 2: Add a Conditional Statement to Each Email Action
This is also super easy. Click on the first email action to add a conditional statement to. I’ll go with Consultation. That slides open the action’s settings window:
Set up the To field, subject, and email message as appropriate to your needs. With that done, expand the Conditional Logic options that I have circled in the above screenshot.
You can see below how I’ve set the conditional statement for this email. You want this Process This action when “What Services May We Assist You With” Has Selected the Consultation radio list option. This targets the Consultation radio list option of the “What services may we assist you with?” radio list field of the form, so that when it is checked and the form is submitted, this email action will fire. This email action will now not fire unless this condition is met!
To finish, all you would need to do now is repeat Step 2 for the other 3 email actions, setting each conditional statement appropriately for that action. At that point you have a form that will send conditional email to any combination of 4 departments selected by the user in the form!
The power at your disposal with Conditional Logic is great. Send reports submitted from a job site to the appropriate parties. Set triggers in a form that notify relevant parties when those values drop below or exceed a certain threshold. Automate email responses to certain individuals when given criteria are met. Mix in a newsletter extension like MailChimp and you can start segmenting signups based conditionally on survey questions etc… the possibilities for really awesome things are out there!