# Sitecore 8 Web Forms For Marketers (WFFM) email settings cheat sheet


<!--kg-card-begin: markdown-->
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](https://doc.sitecore.net/web_forms_for_marketers/working_with_actions_and_validations/save_actions/specify_different_smtp_settings_for_the_send_email_message_save_action) 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:

```xml
<Host>smtp.domain.com</Host>
<Port>587</Port>
<Login>user@domain.com</Login>
<Password>b</Password>
<From>user@domain.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>user@domain.com</CC>
<BCC>user@domain.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 `processMessage` pipeline.

```xml
<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="user@domain.com" />
      <setting name="MailServerPassword" set:value="b" />

      <!-- Corresponds to <From> - default sender address -->
      <setting name="Analytics.EMailFromAddress" set:value="user@domain.com" />
    </settings>
  </sitecore>
</configuration>
```
 
## Note when upgrading from Sitecore 6.5
 
Most of the forms created with the earlier version of WFFM had `<Host>` and `<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](https://gist.github.com/Krusen/42b49e7df2657ba6935caa19b6b94d20) to do this for us - **use at your own risk!**
 <!--kg-card-end: markdown-->
