Sitecore 8 Web Forms For Marketers (WFFM) email settings cheat sheet
2 min read
I've just been working with WFFM a bit - migrating forms from Sitecore 6.5 - and had to also set it up to use TLS for the mail server.
This post is basically just a cheat sheet of the email options that can be configured and where you can configure them.
The official documentation explains the basics like mail server and credentials etc. but it's missing a few bits.
The 'Send Email Message' save action parameters
On the item
/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions/Send Email Message in the Parameters field you can specify values (as XML) for the following settings:
<Host>smtp.domain.com</Host> <Port>587</Port> <Login>firstname.lastname@example.org</Login> <Password>b</Password> <From>email@example.com</From> <EnableSsl>true</EnableSsl> <IsBodyHtml>true</IsBodyHtml> <IsIncludeAttachments>false</IsIncludeAttachments> <!-- Not mentioned in official docs but should work as well --> <Subject>Default subject</Subject> <Mail>Default email body</Mail> <CC>firstname.lastname@example.org</CC> <BCC>email@example.com</BCC> <LocalFrom></LocalFrom> <RecipientGateway></RecipientGateway> <FromPhone></FromPhone>
Settings from config files
It's only a subset of these settings that can be specified in config files. Values specified on the save action item itself will override any values from config files. Settings like EnableSsl, IsBodyHtml and IsIncludeAttachments can sadly only be specified on the save action although it should be somewhat trivial to change this, potentially by hooking into the
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/"> <sitecore> <settings> <setting name="MailServer" set:value="smtp.domain.com" /> <setting name="MailServerPort " set:value="587" /> <setting name="MailServerUserName" set:value="firstname.lastname@example.org" /> <setting name="MailServerPassword" set:value="b" /> <!-- Corresponds to <From> - default sender address --> <setting name="Analytics.EMailFromAddress" set:value="email@example.com" /> </settings> </sitecore> </configuration>
Note when upgrading from Sitecore 6.5
Most of the forms created with the earlier version of WFFM had
<From> parameters with the default values specified on the form itself in the Save Actions field. These were overriding anything specified in either config files or on the save action item. To fix this we had to manually edit the XML of the Save Actions field on all the forms.
The old forms also had a reference to the old Save to database save action (that no longer exists after 8.0) which we also had to remove.
I created this
.aspx page/script to do this for us - use at your own risk!