November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
I think I found the issue. We have a CaptchaValidator on a partial view that is attached to our XForm. This Post Action Result is basically eating the XFormDataEventArgs on the Before and After post data events. Not sure how to get around this.
I'm trying to intercept any XForm email to add my own formatting. I have a test form created and a button to trigger saving to the DB and send an email. The following event does fire, but e.FormData.ChannelOptions is always equal to ChannelOptions.None. I can never trap the XForm from sending the email.
private void OnBeforeSubmitPostedData(object sender, XFormDataEventArgs e)
{
//***********************************//
//*** Result from sending ***//
//***********************************//
//ChannelOptions.None = 0, Nothing happens.
//ChannelOptions.Database = 1, Save to database.
//ChannelOptions.Email = 2, Send e-mail.
//ChannelOptions.CustomUrl = 4, Post the data to a different Web page.
if ((e.FormData.ChannelOptions & ChannelOptions.Email) == ChannelOptions.Email)
{
//Remove the option to send email directly from the XForm
e.FormData.ChannelOptions &= ~ChannelOptions.Email;
//***********************************//
//*** Send e-mail to this address ***//
//***********************************//
string emailAdressTo = e.FormData.MailTo;
//***********************************//
//*** E-mail address of sender ***//
//***********************************//
string emailAdressFrom = e.FormData.MailFrom;
//***********************************//
//*** E-mail subject ***//
//***********************************//
string messageSubject = e.FormData.MailSubject;
System.Collections.Specialized.NameValueCollection formValueCollection = e.FormData.GetValues();
mailer = new Mailers();
var message = mailer.XFormEmail(emailAddressTo: emailAdressTo, messageSubject: messageSubject, messageFields: formValueCollection);
message.Send();
}
}