SQL 2016 Won’t Send Mail

I’ve come across this problem a few times and always end up googling it so I figured I would make a post for my own benefit and also to help anyone else running into the issue.

Basically the RTM version of SQL Server 2016 has a bug in it where it doesn’t reference the correct .NET version.

You can fix the issue by doing one of these work arounds.

1) Create a DatabaseMail.exe.config file and place it with DatabaseMail.exe under the Binn folder. The easiest way is to use Notepad and then to choose UTF-8 encoding when Saving the file.

         <?xml version="1.0" encoding="utf-8" ?>

         <configuration>

         <startup useLegacyV2RuntimeActivationPolicy="true"> 

         <supportedRuntime version="v4.0"/>     

         <supportedRuntime version="v2.0.50727"/>

         </startup>

         </configuration>

2) Run setup repair of SQL Server 2016. I don’t recommend this option.

3) Install .Net Framework 3.5.

4) Update SQL 2016 to SP1 and the Latest CU.

See this Microsoft KB for more details. https://support.microsoft.com/en-ph/help/3186435/sql-server-2016-database-mail-doesn-t-work-when-net-framework-3-5

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true"> 
<supportedRuntime version="v4.0"/>     
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>