DatabaseMail.exe fails after SQL Server 2022 from CU22 to CU23 - Missing Microsoft.SqlServer.DatabaseMail.XEvents.dll

Musa YILMAZ 80 Reputation points
2026-01-19T07:29:32.3466667+00:00

Product: SQL Server 2022 Enterprise Edition
Affected Versions: CU23
Component: Database Mail

Summary: Database Mail fails to start or send emails after updating to SQL Server 2022 CU23 (also observed on CU22) with error indicating missing assembly Microsoft.SqlServer.DatabaseMail.XEvents.dll. This DLL does not exist in any SQL Server 2022 installation (verified on multiple servers), yet DatabaseMail.exe attempts to load it.

Error Message:

Could not load file or assembly 'Microsoft.SqlServer.DatabaseMail.XEvents, Version=16.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

Steps to Reproduce:

  1. Install SQL Server 2022 with Database Mail configured
  2. Update to CU23 (or observe on CU22)
  3. Attempt to start Database Mail via EXEC msdb.dbo.sysmail_start_sp
  4. Attempt to send email via sp_send_dbmail
  5. DatabaseMail.exe process fails or emails remain stuck in "unsent" status

Investigation Findings:

  1. Microsoft.SqlServer.DatabaseMail.XEvents.dll does NOT exist in:
    • C:\Program Files\Microsoft SQL Server\160\Shared
    • D:\MSSQLServer\MSSQL16.MSSQLSERVER\MSSQL\Binn
    • GAC (C:\Windows\Microsoft.NET\assembly)
    • Verified on BOTH working and non-working servers
  2. Other XEvent DLLs exist:
    • Microsoft.SqlServer.XEvent.Configuration.dll
    • Microsoft.SqlServer.XEvent.dll
    • Microsoft.SqlServer.XEvent.Linq.dll
    • Microsoft.SqlServer.XEvent.Targets.dll
  3. The assembly is referenced in DatabaseMail.exe code but was never shipped with SQL Server 2022
  4. SQL Server Repair does not fix the issue
  5. Some servers with identical CU versions work fine, others fail - suggesting installation inconsistency or missing component in certain update paths

Workaround Attempted: Copying DatabaseMail.exe and dependencies from working server to non-working server provides temporary relief, but this is not a sustainable solution for production environments.

Impact:

  • Database Mail completely non-functional
  • Critical for automated alerting, reporting, and monitoring
  • Affects multiple production servers
  • No clear resolution path without Microsoft fix

Request: Please either:

  1. Include Microsoft.SqlServer.DatabaseMail.XEvents.dll in future CUs/hotfixes, OR
  2. Remove the dependency from DatabaseMail.exe, OR
  3. Provide official workaround/hotfix

Environment Details:

  • SQL Server Version: SQL Server 2022 CU23
  • OS: Windows Server 2022
  • Database Mail configured with valid SMTP profiles

Additional Notes: This issue appears to affect servers updated through certain paths. Clean installations or servers updated differently may not exhibit the problem, suggesting a CU update packaging or dependency issue.

Impact:

  • Database Mail completely non-functional
  • Critical for automated alerting, reporting, and monitoring
  • Affects multiple production servers
  • No clear resolution path without Microsoft fix

Request: Please either:

  1. Include Microsoft.SqlServer.DatabaseMail.XEvents.dll in future CUs/hotfixes, OR
  2. Remove the dependency from DatabaseMail.exe, OR
  3. Provide official workaround/hotfix

Best regards.

SQL Server Database Engine
{count} votes

Answer accepted by question author
  1. Oliver 120 Reputation points
    2026-01-20T08:52:42.35+00:00

    UPDATE: Microsoft have now re-released CUs with the Database Mail issue resolved. This is their description from CU23 for SQL Server 2022:

    The initial release of this cumulative update (KB5074819), released on January 15, 2026, contained an issue that caused Database Mail to stop working. You might also see the following error message:

    Could not load file or assembly 'Microsoft.SqlServer.DatabaseMail.XEvents, Version=17.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

    This issue affects SQL Server product version 16.0.4235.2 and file version 2022.160.4235.2.

    This issue is resolved in the current version of this cumulative update (KB5078297).
    If you downloaded the initial release of this update, don't install it. Download and install the current version instead.

    If you already installed the initial release, uninstall it or install the current version on top of the initial CU23 release (KB5074819) to restore Database Mail functionality.

    Future cumulative updates also contain the fix for this issue. You can install them regardless of which version of this cumulative update is currently installed.

    Email messages queued through Database Mail while the initial release was installed aren't automatically resent when you uninstall it or install a cumulative update that contains the fix.

    PREVIOUS WORKAROUND:


    We have the same issue after updating to CU23. DatabaseMail not working across all of our instances.

    Fortunately we had one instance which we hadn't upgraded, so I relucantly did the following as a workaround:

    • Checked for unsent mail:
    SELECT
        mailitem_id,
        profile_id,
        recipients,
        subject,
        send_request_date,
        sent_status,
        sent_date
    FROM dbo.sysmail_allitems
    WHERE sent_status <> 'sent'
    
    • Stop the Database Mail service
    EXEC msdb.dbo.sysmail_stop_sp;
    
    • Navigate on a working (pre-CU23) instance to C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Binn and copy these three files:
      • DatabaseMail.exe
      • DatabaseMailengine.dll
      • DatabaseMailprotocols.dll
    • Navigate on the non-working instance to C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Binn and replace the three files with those copied from the working instance (take a backup first):
      • DatabaseMail.exe
      • DatabaseMailengine.dll
      • DatabaseMailprotocols.dll
    • Start the Database Mail service
    EXEC msdb.dbo.sysmail_start_sp;
    
    • Re-check for unsent mail. For us, on all instances, the unsent mail was sent automatically straight away without error.

    Appreciate some may not like to bodge production servers by replacing exe/dlls, but it is working fine for us so far, and t didn't require any restart (besides the Database Mail service).

    Before implementing any hotfix or reapplying the fixed CU from Microsoft (whenever it arrives), I will make sure to revert to the three 'non-working' files previously backed up, just in case this workaround interfers with the update process (i.e. it doesn't like the older exe/dlls).

    9 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Dennis H 0 Reputation points
    2026-01-19T23:24:05.36+00:00

    Hello everyone this issue has been raised to our attention and we're working diligently with our internal teams to get this resolved.


  2. Musa YILMAZ 80 Reputation points
    2026-01-19T11:25:37.7333333+00:00

    Not a solution however, I wrote a workaround.
    A custom PowerShell script polls msdb.dbo.sysmail_mailitems for unsent items (status 0/2), extracts profile/account/SMTP settings dynamically, sends emails using Send-MailMessage (anonymous/relay mode), then updates sent_status = 1 and logs to a custom table (WorkaroundMailLog).

    The script runs every few minutes via Task Scheduler or SQL Agent Job and is fully transparent to SQL Agent jobs and sp_send_dbmail callers. Emails are now sending successfully (plain From address used to avoid header issues in PowerShell 5.1).

    This bypasses the broken DatabaseMail.exe entirely. We'll monitor for an official fix in future CUs/hotfixes.

    You can find the script in this repository below.
    https://github.com/CopyZenx/DatabaseMailWorkaroundViaPowerShell/tree/main


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.