In SQL Server sp_send_dbmail use to send emails and the SQL Server log all the status of each message processed by Database Mail. Below is the quick list of Database Mail Views you can query to find the status of each sp_send_dbmail call.
Here is a simple TSQL script to find the status of the email sent from the SQL Server.
select recipients , subject , convert(VArchar(12) , send_request_date , 103) [Sent Date],
CAST(send_request_date AS time(0)) [Sent Time] ,
sent_status from sysmail_allitems where cast(send_request_date as date) = '13-june-2022' -- Sent Data
--and subject like '%Mail Sent Through alertsprofile%' -- Search by subject name
--And recipients like '%sanjay%humania%' -- Search by recipients name
order by CAST(send_request_date AS time(0)) desc
Query output will be as below.
Recently we moved whole on-premises resources to the cloud. In an easy word, we have moved SQL Server from on-premises…
In SQL Server sp_send_dbmail use to send emails and the SQL Server log all the status of each message processed…