Try our conversational search powered by Generative AI!

XForms - Stop EPiServer from sending emai


I want to stop EPiServer from sending a mail when a form is submitted. This was supposed to be as easy as hooking up to the BeforeSubmitPostedData event and setting the ChannelOptions as in the code below, but when the event fires e.FormData.ChannelOptions is always None so changing it here has no effect.

if ((e.FormData.ChannelOptions & ChannelOptions.Email) == ChannelOptions.Email)
    //  e.FormData.ChannelOptions is always None here
    e.FormData.ChannelOptions &= ~ChannelOptions.Email;


In my PostAction I found that xFormpostedData.SelectedSubmit.ChannelOptions have the correct values, but I cannot set it here cause it has noe setter.

public ActionResult DoSubmit(XFormPostedData xFormpostedData)
    // In variable below we get the correct ChannelOptions
    var tmp = xFormpostedData.SelectedSubmit.ChannelOptions;
    return _xformHandler.HandleAction(this);

// This is how I am rendering the form in the view
@Html.PropertyFor(x => x.XForm, new { XFormParameters = new EPiServer.XForms.Util.XFormParameters() { PostAction = "DoSubmit", SuccessAction = "Success", FailedAction = "Failed" } })


What am I missing?

Feb 06, 2014 20:05

XForms should only send email if the editor has told the form to do so.

Does it send email even if you select "save to database"?

Feb 06, 2014 22:49

Sorry, I didn't give the full picture here.

No it doesn't send email if that option is not selected, but I want to send a custom email when the editor have selected that option. That's why I need to stop EPiServer from sending email automaticly.

I've followed this blog and my custom mail sends as it should. But now two emails is being sendt. My email and EPiServers email.


Feb 07, 2014 9:16

Did anyone find a solution to this problem? I'm having diffulties canceling the submit.

Apr 15, 2014 16:15
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.