SQL Server 2022 Contained AGs and database mail
0
votes
0
answers
113
views
I have two SQL Server 2022 environments with Contained AG configured with a listener that the users are connecting too. All three have db mail configured identically. The two servers are able to successfully send mail using db mail but the listener does not. This is an issue because the users are creating sql server jobs on the listener and they want to be alerted on job failures. How do I configure the listener so that jobs created on the listener are able to email notifications on job failure?
As per Sean Gallardys comments below.
I have two DB Instances with DBMail configured Identically. Test email succeed on both. sysmail_allitems shows a sent_status = Sent.
I have made a contained connection via the listener and setup jobs. The jobs failed to notify on success. I configured DBMail on the contained connection with the same configuration as on the Instances. I then performed a test email. sysmail_allitems shows a sent_status = unsent even after days have past. No error is generated.
As said in my comment below the sysmail_event_log table was blank as in empty. Yesterday while attempting to troubleshoot I ran the sysmail process manually multiple times.
EXEC msdb.dbo.sysmail_stop_sp;
EXEC msdb.dbo.sysmail_start_sp;
Here is the resulting screenshot.
Here is the screenshot of the sysmail_allitems as of today showing the mail as unsent.
Database Mail XPs are enabled, the broker is enabled, and the mail queue is stuck in an INACTIVE State.
I am receiving the following error in the error log:
Database Mail is not enabled for agent notifications. Cannot send e-mail to DENTISTRY_SCHEDJOBS
However, mail has been configured and the agent does have access.




Asked by Lumpy
(2129 rep)
Aug 29, 2025, 03:12 PM
Last activity: Sep 10, 2025, 04:13 PM
Last activity: Sep 10, 2025, 04:13 PM