Want to Send Email Conditionally Based on User Selection? Here’s How!

***This article references our now deprecated 2.0 codebase; for instructions on conditional email in the modern Ninja Forms 3.0 codebase, please click here!***

The ability to send email conditionally based on user selection is a commonly requested feature in Ninja Forms. It’s also very easy to set up! If you weren’t aware that this is something you could do with your forms, it can be incredibly useful. Often times you’ll want specific people to be aware of information submitted with a form, but the whole team doesn’t need to get the alert. If that’s the case, then sending email conditionally can save the rest of your team time, and your business money. Let’s look at how to set this up!

What You Need

You’ll be using the Email and Actions feature in Ninja Forms core, plus the ability to add conditional statements, so:

That’s it!

How to Send Email Conditionally Based on User Selection

I’ve set up a simple 3-field form to demonstrate this:

ss1 send email conditionally based on user selection

The “Department” field is the only field relevant to this example. It’s a radio list in which the user can select Development, Support, or Marketing. Based on the department the user selects, we will be sending an email conditionally to that department. Each department selected will receive an email, and any department not selected will not receive an email.

Your form doesn’t have to use a radio list. This could be done with three completely separate fields, or really any combination of fields you like. What matters is how we set the conditional statement in the email action in just a moment. Let’s walk through the steps now to send email conditionally using my example form.

1) Click on the Email and Actions tab of your form builder and add a new action.

2) Set up your email action normally. The part we want to focus on specifically to send email conditionally based on user selection is the Conditional Processing feature of this page.

3) Find Conditional Processing on this page and click “Add”. “Process This” and “All” are selected by default, leave these be.

4) We’ll set this action up to send the Development department an email. Click “Add Criteria” now, and from the dropdown under Fields, select “Department ID-xx” (this targets the Department list field). Leave “Equal To” alone, and make sure Development is selected after that. Save the action. This email action will now trigger if and only if Development is selected by the user as they fill out the form!

5) Rinse and repeat steps 1-4, making a new action for each department. The only thing you’ll change each time is the very last field of step 4- Support or Marketing will replace Development in the Conditional Processing statement of each new action.

Here’s a screenshot of my completed Development action’s Conditional Processing:

ss2 send email conditionally based on user selection

That’s all there is to it! The possibilities of what you can set up are certainly not limited to this scenario. Conditional Logic is a very powerful extension that lets you really fine tune the behavior of your form and its actions.

Report submitted from a job site that indicates an accident occurred that day? Make sure the appropriate people are notified automatically. Material report submitted where a specific value is less than/greater than a set threshold? Have an automated email sent to the right people right away. Receive a donation greater than a certain amount? Automatically send out a specialized thank you email that’s different than the standard one.

Possibilities abound. If you have any questions, fire away below!