Customize the Send Email Message save action
Version: 9.0
The Send Email Message save action sends an e-mail message every time a visitor clicks the Submit button on a web form. You can configure an email message in this save action using the ProcessMessage pipeline.
To configure an email message:
-
Create a processor class using the following sample code:
RequestResponseusing Sitecore.Form.Core.Pipelines.ProcessMessage; // This processor adds a note to the end of the email body public class AddTextToBody { public void Process(ProcessMessageArgs args) { string additionalText = "<p>This message was sent using the Sitecore Web Forms for Marketers module.</p>"; args.Mail.Append(additionalText); /* * it's also possible to modify SUBJECT, TO, CC and BCC message fields * args.Subject.Append(" subject text"); * args.To.Append("; [email protected]"); * args.CC.Append("; [email protected]"); * args.BCC.Append("; [email protected]"); * args.From = "[email protected]"; */ } } -
Register the new processor in the
Sitecore.Forms.configfile, before theSitecore.Form.Core.Pipelines.ProcessMessage.ProcessMessageprocessor:RequestResponse<processMessage> … <processor type="YourNamespace.AddTextToBody,YourAssemblyName" /> <processor type="Sitecore.Form.Core.Pipelines.ProcessMessage.ProcessMessage, Sitecore.Forms.Core" method="SendEmail"/> </processMessage>