One of the nice things about SQL Server 2016 is that .NET 3.5 is no longer required for installation. The .NET requirement wouldn’t have been problematic, but in order to add the .NET feature access to the Windows media was required (this was particularly painful in Azure VMs). Fortunately the product team eliminated the requirement as part of the release. Unfortunately, a few things broke–namely database mail, native log shipping, and distributed replay. You can identify this problem, by a couple of symptoms:
- Your database mail log has no entries
- You have messages with a status of “unsent’ in sysmail_allitems in MSDB
- If you try to execute the file C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Binn\DatabaseMail.exe you get a .NET 3.5 error
This should be fixed in CU2, but there are reports below of it failing in SP1. The XML to put in the .config files is:
<?xml version=“1.0“ encoding=“utf-8“ ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy=“true“>
<supportedRuntime version=“v4.0“/>
<supportedRuntime version=“v2.0.50727“/>
startup>
configuration>
Hi Joey, there is already a ‘Cumulative Update 2 for SQL Server 2016’ (https://support.microsoft.com/en-us/kb/3182270) with ‘FIX: SQL Server 2016 Database Mail does not work on a computer that does not have the .NET Framework 3.5 installed’ (https://support.microsoft.com/en-us/kb/3186435).
yep, this post was written before CU2 came out.
if you don’t want to use Database Mail or you have SQL Express, try vsql-email, just search on google.
Joey D’Antoni, you’re a genius. Thank you! Helped me solve my issue with SQL Server 2016 RTM.
Hmmm, I’ve got exactly the symptoms detailed here, but on 2016 Ent Ed *SP1* (Microsoft SQL Server 2016 (SP1-GDR) (KB3207512) – 13.0.4199.0)
So the fix in the CU seems to have been regressed?
Unfortunately the workaround (copying the log shipping config file) isn’t working for me however.
Anyone else seeing this, please?
I tried to repro and could not. I did a new install of SP1 on Windows 2016 and mail just worked.
I agree with Emerson – I’m SQL 2016 Std SP1 (Microsoft SQL Server 2016 (SP1-GDR) (KB3207512) – 13.0.4199.0 (X64)) and mail’s not sending. It was prior to SP1 installation as had previously installed CU2… Is Microsoft addressing?
Hmm..I tried to repro again. I installed SQL 2016 RTM, it didn’t work, I installed SP2, database mail worked, and then I installed SP1, and it still worked. I did use Enterprise Edition, but I still can’t think of a reason why this would matter. Just out of curiosity what OS are you on?
Agreed. I have stuck email on SQL Server 2016 (SP1-CU1) (KB3208177) – 13.0.4411.0 (X64) , Windows Server 2012 R2 Standard 6.3
Windows 2012 R2 with all latest updates applied. I gave in this afternoon, battled for several days, and installed .Net 3.5. Bugger but needed this working in a production enviro.
Cheers
Thanks–I’ll pass thing thread along to the product group. I’m wondering if OS is a factor as I was using Win 2016
You can always replace the contents of the .config file with:
I’ll have to look into what happened in SP1 to the .config files.
Kevin Farlee
SQL Server team
Looks like the blog stripped out the XML. Let’s see if this works:
.
.
.
.
.
.
.
You’ll have to delete the “.” at the start of each line.
I’m not seeing anything in your post other than the “.” Can you resend? I’m having this same issue on a SQL 2016.1 Standard server.
Which config file(s)?
C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Binn\DatabaseMail.exe.config
Thank you for the info!
FYI I just spent several frustrating hours on this and finally landed here after checking all the usual suspects.
Our SP1-CU2 machine gave the .NET 3.5 message when double-clicking on DatabaseMail.exe. Further, there was no associated DatabaseMail.exe.config file.
However, I grabbed the config from another SQL 2016 instance (pure SP1 no CU) on which mail *is* working and used that. For reference, here are the XML contents. Tags are replaced with + signs in an attempt to avoid having the XML stripped out of the post.
+?xml version=”1.0″ encoding=”utf-8″ ?+
+configuration+
+startup useLegacyV2RuntimeActivationPolicy=”true”+
+supportedRuntime version=”v4.0″/+
+supportedRuntime version=”v2.0.50727″/+
+/startup+
+/configuration+
This worked perfectly for me. 2016 SP1 CU2 on Server 2012 R2.
I had no DatabaseMail.exe.config file so manually created it and added the XML code above. Sent a test email via SSMS and it worked!
Thanks,
Hi,
Sorry I didn’t get back sooner about OS, Joey. And thanks for trying to repro!
Some good news for me – and hopefully for others!
After installing CU1 for SP1, it was still broken. BUT I then found if I created a DatabaseMail.exe.config in the *same folder* as DatabaseMail.exe, this fixed it. Either a copy of SqlLogShip.exe.config, or slightly different XML as per https://www.reddit.com/r/SQLServer/comments/4rd5kg/sql_server_2016_database_mail_and_net_35_framework/, is working for me.
OS is Server 2012 R2, BTW. My install is under D:\, not C:\ – just in case that’s part of the issue
(surely not!) 😮
P.S. for anyone on various fora saying “just install .NET3.5”, it’s not only that you need OS media – you then need to apply at least 22 critical/security updates (on 2012 R2 anyway), plus reboot…
I think I love you. We are on RTM and the .config file workaround worked.
We will patch to SP1-CU2 and see if the issue is fixed there.
Thanks!
Superb! The missing config file was the culprit. This saved hours of time as we were completely baffled.
This was an awesome hint!! We faced this issue in production today while setting up new servers and had already spent several hours before I came across this post. We created a config file where it was missing and boom – DBMail worked!!
I copied and pasted the XML above and fixed the tags and it still didn’t work. Come to find out that my double quotes where back ticks and not quotes. Just wanted to mention this if somebody else ran into the same problem. I copied the config from a running system and found my issue.
Hi Team,
I have installed SQL 2016 SP2, CU16 , still DB Mail is not working, from this blog I have added config file , still DB mail not working I have installed .Net 3.5 SP1 as well though it is not working, any inputs please
OS Windows 10 server:
DatabaseMail.exe.config:
Is reboot or repair is mandatory..? please suggest
Pingback: SQL Server 2016 DB Mail Not Sending