WFFM – Send Email Based on dropdown list selection

Let assume that you have contact us form and you need to send email based on selected enquiry from drop-down list :



you can achieve that by 4 steps :

1)  Adding enquiry types in Sitecore under global folder and  define email field for each enquiry:



2) Create drop list field in contact us form, and select enquiry types folder :


3) Create new processor to retrieve the email based on selection value from the drop-down list and append it to the “To” property :

namespace Test.Pipelines
 public class SendCustomEmail
 public void Process(ProcessMessageArgs args)
 var field = args.Fields.GetEntryByName("Enquiry");
 if (field == null)
 var fieldValue = field.Value;

var enquiryEmail = GetEnquiryEmailByName(fieldValue);

if (args.To.Length != 0)

 public string GetEnquiryEmailByName(string enquiry)
 //default email
 string email = "";
 var enquiryTypesFolder = Sitecore.Context.Database.GetItem("{4F21D5E1-5C38-472C-A2F4-D22DBBEA5B41}");
 if (enquiryTypesFolder !=null)
 var children = enquiryTypesFolder.Children;
 if (children.Count>0)
 var emailItem = children.SingleOrDefault<Item>(p => p.Name.Equals(enquiry));
 if (emailItem!=null && !string.IsNullOrEmpty( emailItem["Email"]))
 email = emailItem["Email"];
 return email;

4)  Register it  in Sitecore.Forms.config  file before Sitecore.Form.Core.Pipelines.ProcessMessage.ProcessMessage 


That’s it 🙂

I hope you find this post helpful, If you have any additional knowledge on this subject, comments or questions, please let me know in the comments section below.


2 thoughts on “WFFM – Send Email Based on dropdown list selection

  1. Not sure if customization is needed for this. You can use emails IDs as VALUE property for dropdowns and Caption as text. Yes, Customization needed if two dropdown values uses the same Emails Ids.


    1. Hi Vyas,
      Customization is required here to send email to the selected value from dropdown list, you need to write code to route an email to the specific email selected from dropdown list, for adding those values under global folder i have my reason for that as i want them sitecore items, and it is fine you can add those values as you said like “Email ID” as “Value” and and “Enquiry Type” as “Text”, but again i am talking in my post about routing an email and this will not work out of the box


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s