SQL Server 2016 - Database Mail doesn't work without .NET 3.5 - by Tomasz Libera

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 2900323 Comments
Status Closed Workarounds
Type Bug Repros 7
Opened 7/6/2016 9:17:46 AM
Access Restriction Public


SQL Server 2016 - Database Mail doesn't work without .NET 3.5

In installed SQL Server Standard on Windows Server 2012 R2 (VM Ware 5.5 virtual machine). 
Installed features:
- DB engine
- SQL Server Replication. 

After creating all my jobs and alerts I realized that Database Mail (properly configured) doesn't work. I checked everything... a lot of times...
Messages still remained in "unsent" status.
Database Mail Log empty.

EXEC msdb.dbo.sysmail_help_queue_sp @queue_type = 'mail';
queue_type	length	state

Finally I decided to install SQL Server 2014, during setup it asked me to install .NET Framework 3.5. After I added required roles in Server Manage (before installing  SQL Server 2014), I checked Database Mail - it works..ów)
Sign in to post a comment.
Posted by Microsoft on 10/25/2017 at 1:07 AM
Let me say one more time to set the expectation:
- SQL 2016 SP1 (slipstream) + SQL2016 SP1 CU4: DatabaseMail.exe.config is not deleted, hence DatabaseMail.exe works just fine.
- SQL 2016 RTM + SQL 2016 SP1 + SQL2016 SP1 CUx: DatabaseMail.exe.config is not recreated, hence you need to apply the workaround either before or after installing the CU in order to have a working DatabaseMail.exe without requiring NetFx3.5 on the machine

In other word, the fix is to prevent the CU from deleting the DatabaseMail.exe.config file; it is not meant to recreate the file when the file does not exists.

Posted by BobSwi on 10/16/2017 at 11:17 AM
Just came across this issue on a fresh install of SQL 2016 SP1 with CU4 applied. Obviously not fixed yet.
Followed the instructions here: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/10d759dc-9e68-4083-b23c-a29766444766/2016-database-mail-stuck-in-inactive?forum=sqlsetupandupgrade
to create a DatabaseMail.exe.config file, re-sent a test email, and all the queued up emails came along. Thankfully this wasn't in production yet, however there's no need for a .NET 3.5 install/reboot.
Posted by Microsoft on 9/7/2017 at 11:51 AM
Hi OneWithQuestions,
Could you clarify your scenario? Are you saying that you have a working DatabaseMail on your system (what version of SQL2016? RTM? SP1? What CU? or what GDR?), then you upgraded (to what CU or GDR?) and then DatabaseMail stopped working?

Posted by OneWithQuestions on 9/7/2017 at 11:45 AM
Agree, just ran into this issue after doing the most recent update.... also WHY do we need .NET 3.5 in the first place for database mail????
Posted by J GENSKE on 8/11/2017 at 6:51 AM
This is broken again after latest Patching on 8/9 not sure it is KB4019089 or a separate Windows Patch, but we had to install .Net 3.5 to get DB mail working again
Microsoft SQL Server 2016 (SP1-GDR) (KB4019089) - 13.0.4206.0 (X64) Jul 6 2017 07:55:03 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: ) (Hypervisor)
Posted by Microsoft on 6/19/2017 at 12:37 PM
@rseiler: let me clarify a bit:
"SQL2016 SP1 + CU2" really means "Install SQL2016 SP1 Slipstream, then apply CU2"
Your scenario ("2016->SP1->CU2") is different, as it install SP1 on top of SQL2016 RTM, and as such it exposes the isssue (which needs to be worked around).

Please, let me know if that was not the case.

Posted by rseiler on 5/22/2017 at 4:00 PM
There's a helpful KB about this for anyone needing it:

I think one aspect of it is wrong though: "If you install SQL Server 2016 SP1 + CU2, the Database Mail will not be impacted by the setup." That can't be true, since we took the 2016->SP1->CU2 path (given that this is a new install), and we still had the issue. There was never a CU1 involved.

Creating the DatabaseMail.exe.config mentioned though resolved it--WITHOUT doing a repair or installing .Net 3.5 (I don't know why those last two steps would be necessary for anyone on CU2).
Posted by MS BI Guy on 4/3/2017 at 2:50 PM
Sorry please excuse me! I found an error in my databasemail.exe.config file. My apologies.
Posted by MS BI Guy on 4/3/2017 at 2:43 PM
Hi guys I am on CU2 - Microsoft SQL Server 2016 (SP1-CU2) (KB4013106) - 13.0.4422.0 (X64) and I can confirm this is STILL an issue. I get the following error in the event logs.

1) Exception Information
Exception Type: System.TypeInitializationException
TypeName: System.Data.SqlClient.SqlConnection
Message: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void .ctor()
HelpLink: NULL
Source: System.Data
HResult: -2146233036

StackTrace Information
at System.Data.SqlClient.SqlConnection..ctor()
at System.Data.SqlClient.SqlConnection..ctor(String connectionString, SqlCredential credential)
at Microsoft.SqlServer.Management.Common.SqlConnectionInfo.CreateConnectionObject()
at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.ConnectionManager.OpenConnection(SqlConnectionInfo connectionInfo)
at Microsoft.SqlServer.Management.SqlIMail.IMailProcess.QueueItemProcesser.ProcessQueueItems(String dbName, String dbServerName, Int32 lifetimeMinimumSec, LogLevel loggingLevel, Byte[] encryptionKey, Int32 connectionTimeout)

Posted by Newfangled Old-fashioned Stuff on 3/24/2017 at 10:47 PM
This is STILL NOT FIXED in SQL 2016 SP1 CU2 (Build 4422), at least when upgrading from Build 4411, including a reboot after.

There were quite a few GUI popups about "unable to install .NET 3.5", as normally an "alternate source path" has to be supplied - mount the ISO and then point it at CDROM:\Sources\sxs, for instance.

Installed .NET 3.5 with an alternate source path that went to the right Windows Server ISO and suddenly the existing SQL 2016 SP1 CU2 Build 4422 started sending new emails.

Microsoft, automatically triggering an installation of .NET 3.5 is NOT an answer, even if it worked, which in most cases it DOES NOT. The only correct answer is to require the SAME version of .NET that the rest of SQL Server requires.
Posted by Piquet de Noo on 2/27/2017 at 5:41 PM
As per Newfangled comment I can confirm this issue is still present for "Microsoft SQL Server 2016 (SP1-CU1) (KB3208177) - 13.0.4411.0 (X64) Jan 6 2017 14:24:37" on Windows Server 2016.
Installing .Net Framework 3.5 resolved the issue (i.e. DatabaseMail now works), but .Net Framework 3.5 is not in the pre-requisite checks during installation or DBMail configuration.
Posted by Newfangled Old-fashioned Stuff on 1/27/2017 at 11:30 PM
Either this is NOT fixed on SQL 2016 SP1 CU 1 (Build 4411), OR it was fixed by the huge error message that shows up when you try to run DatabaseMail.exe from the command line and it says
The following feature couldn't be installed:
.NET Framework 3.5 (includes .NET 2.0 and 3.0)
Posted by Microsoft on 9/28/2016 at 8:56 AM
Hi Tomasz,
Yes, we are aware of this issue in SQL 2016 - it has been reported a few times already.

The fix for this issue is included in SQL2016 CU2 (and later) and will be rolled into a future SP, as usual.

Here's the link to the CU2 KB: https://support.microsoft.com/en-us/kb/3182270

Note: I need to talk to the documentation folks and find out why this fix is not listed on that page. I'll try to have that updated to avoid confusion.

Posted by Lin Leng on 7/19/2016 at 8:25 PM
similar thread here: