In my current implementation I was asked to use SMTP settings which only supports connections over TLS or SSL. I am using Sitecore 9 in my current project.
By default, Sitecore does not use SSL for sending emails, and this is something that you need to adjust yourself by adding enableSSL in your web.config file.
This configuration only effects the emails that Sitecore send for there internal use like forgot Sitecore password and also If you are using Sitecore OOTB or default function for sending emails for example Sitecore.MainUtil.SendEmail method.
In previous versions, we configured the SSL-setting in a standard ASP.NET fashion, by adding the below setting into web.config file:
<system.net> <mailSettings> <smtp deliveryMethod="Network"> <network enableSsl="true" /> </smtp> </mailSettings> </system.net>
But in Sitecore 9 it doesn’t work anymore. I didn’t find any post about that there is some changes in configration for not to use settings given in web.config file. I thought there is some issue with my set up so made many changes in that. After almost wasting 4-5 hours and trying many things I started looking into different direction.
Now I was pretty sure that there is some changes on Sitecore side. So I started digging into the dll’s. And finally after digging into Sitecore.Kernel I found that Sitecore has introduced a new setting for this, which I am not sure in which version of Sitecore this was changed, but I do know that this is with Sitecore9.x.
Adding <setting name=”MailServerUseSsl” value=”true”/> will work in Sitecore 9 for SSL
Below is the new configuration settings for Sitecore9 –
<sitecore> <settings> <setting name="MailServer" value="[enter value]"/> <setting name="MailServerUserName" value="[enter value]"/> <setting name="MailServerPassword" value="[enter value]"/> <setting name="MailServerPort" value="[enter value]"/> <setting name="MailServerUseSsl" value="true"/> </settings> </sitecore>
I am sure if you are going to start with Sitecore 9 and planing to use Sitecore forms for sending emails or simple .net forms and specially if your smtp settings are working over SSL then it can save your some time if you are not aware about this change.