Sql-server – Missing DatabaseMail.exe.config after applying SQL Server 2016 SP2 CU1

patchingsql-server-2016

After applying SQL Server 2016 SP2 CU1 (SP2 was already applied) to SQL Server 2016 on several different Windows Server 2016 installations, we noticed that Database Mail stopped working. Mails were being queued but not sent and we could find no error messages on the servers, neither in the SQL Server logs nor in the Windows Server event logs.

After verifying that none of the settings for Database Mail had changed and that everything was as it should be with regards to mail relaying server and other external factors, we could see that an old problem seemed to have resurfaced:

The DatabaseMail.exe.config configuration file for DatabaseMail.exe, allowing it to work without having .NET Framework 3.5 installed, had been removed by the SQL Server 2016 SP2 CU1 update.

On all instances where the patch had been applied, the config file above was missing from the binaries directory for the SQL Server installation. It was present before the patch was applied.

Example configuration file path:
C:\Program Files\Microsoft SQL Server\MSSQL13.instance_name\MSSQL\Binn\DatabaseMail.exe.config

Best Answer

The main point of the question was to check if other people had the same issue and to help spread the information on issues with the SQL Server 2016 SP2 CU1 patch. Since these objectives have been reached and there is a solution presented in the post, I will close this as answered.

The solution was as follows:

We recreated the file based on the following KB article: https://support.microsoft.com/en-us/help/3186435/fix-sql-server-2016-database-mail-does-not-work-on-a-computer-that-doe

After that we had to restart the Database Mail queues to start processing queued mails:

USE msdb;
EXEC sysmail_stop_sp;
EXEC sysmail_start_sp;

This cleared the issue and any queued messages were successfully sent.

Patch link: https://support.microsoft.com/en-us/help/4135048/cumulative-update-1-for-sql-server-2016-sp2