Try our conversational search powered by Generative AI!

XForms - Stop EPiServer from sending emai

Vote:
 

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.

[AcceptVerbs(HttpVerbs.Post)]
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?

#81003
Feb 06, 2014 20:05
Vote:
 

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"?

#81004
Feb 06, 2014 22:49
Vote:
 

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 http://www.frederikvig.com/2009/10/sending-confirmation-email-to-the-user-when-using-episerver-xforms/ and my custom mail sends as it should. But now two emails is being sendt. My email and EPiServers email.

 

#81012
Feb 07, 2014 9:16
Vote:
 

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

#85117
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.