Sitecore 9 quick-tip: Email over SSL

Enabling email over SSL/TSL

This entry is just a quickie, about how to configure Sitecore 9 to use SSL (TSL) for sending email.

By default, Sitecore does not use SSL for emails, so it is something that you need to adjust yourself. This configuration effects the emails that sitecore send out-of-the-box (like, forgotten password emails) and also any emails that you send through the Sitecore.MainUtil.SendEmail or Sitecore.MainUtil.SendEmailAsync methods.

In previous versions, you configured the SSL-setting in a standard ASP.NET fashion, by adding the below to the web.config file:

The old SSL configuration (Don't copy this code for SC9! Read further down, you shortcutter you...)

MailServerUseSsl-old

This does not work anymore, however, which was a bit of a headscratcher for me since I could not find any documentation or other posts about how to configure this any other way. Naturally, I assumed something else was causing the issue and wasted a good half hour trying to find some other error in my setup.

Turns out that Sitecore has introduced a new setting for this, which I only found out by decompiling Sitecore.Kernel and tracking the setting down. I am not sure in which version of Sitecore this was changed, but I do know that this is the current implementation, i.e. used in Sitecore 9.0.1.

The configuration setting for SC9

MailServerUseSsl

Simple as that.

A short note to finish this post off: If you are having issues sending emails over SSL with the WFFM module, there is a special parameter you need to set on the Parameters field of the Send Email Save Action (/sitecore/system/modules/web forms for marketers/settings/actions/save actions/send email message) that looks like this: <EnableSsl>true</EnableSsl>. Please note that this pertains to the old WFFM module, not the new Sitecore Experience Forms.

 

Now go out there and be the best person-sending-secure-emails you can be!

 

 

 

23 Apr 2018, by Bonny Nilsson | 

Sitecore, Sitecore 9, SSL, TSL, Email