November Happy Hour will be moved to Thursday December 5th.

XForm Output - How to Style

Vote:
 

Hello.

When the XForm sends an email out - is there any files/assembly/code that EPiServer uses that determines how this looks when it is outputted? If so, where is it!?

We wish to customise it, so wondering where to start?

Thanks.

#58470
Apr 26, 2012 10:46
Vote:
 

First you need to create an initialization module as a container for your override code. You will find details of how to do this here:

http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-6/EPiServer-CMS-60/Initialization/#Creating

Make sure your module is dependent on the EPiServer.Web.InitializationModule using the ModuleDependency attribute:

[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]

In the Initialize method of your module you can add the following code to customize the email output:

BaseLibrary.Channel.IChannel channel = new SynchronousChannel("xformdata");

EPiServer.XForms.Implementation.EMailConnection emailSender = new EPiServer.XForms.Implementation.EMailConnection();

emailSender.Subject = "MySubject"

emailSender.XMailer = "EPiServer XForms";

emailSender.XsltUrl = url to an Xslt file that transforms the XML Document containin the post;
emailSender.From = "";
emailSender.To = "";


channel.SendEvent += new BaseLibrary.Channel.ChannelEventHandler(emailSender.SendEmail);

channel.SendEvent += new BaseLibrary.Channel.ChannelEventHandler(new EPiServer.XForms.Implementation.HttpConnection().HttpRepost);

channel.SendEvent += new BaseLibrary.Channel.ChannelEventHandler(XForms.XFormData.SaveEventHandler);

BaseLibrary.Context.Repository.UnregisterChannel("xformdata");

BaseLibrary.Context.Repository.RegisterChannel(channel);

 

Please note that I have not compiled or tested this code :-)

#58531
Apr 27, 2012 15:08
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.