Counter of Festivals

Ashok Blog for SQL Learners and Beginners and Experts

Thursday, 2 May 2019

Database mail queued but not sending even Test Mails in SQL Server

Database mail queued but not sending


Some times Server might be brought on from crash or some reason
that time DB mail might struck not sent mail but queued

To resolve this solution

1) check below query to check status of db mail and even testmails also queued

so fix this issue kindly restart SQL service and SQL agent service to fix this issue

-- This one told me that Database Mail was started
EXEC msdb.dbo.sysmail_help_status_sp;
 
-- Here I learned that there were 5 items queued and the last times I tried sending mail
EXEC msdb.dbo.sysmail_help_queue_sp @queue_type = 'mail';
 
-- This confirmed none of the email was sent
SELECT * FROM msdb.dbo.sysmail_sentitems;
SELECT * FROM msdb.dbo.sysmail_unsentitems;
 
-- Is Service Broker enabled? It has to be to send mail
SELECT is_broker_enabled FROM sys.databases WHERE name = 'msdb';
 
-- I tried stopping and restarting the Database Mail exe
EXEC msdb.dbo.sysmail_stop_sp;
EXEC msdb.dbo.sysmail_start_sp;