SQL Sever DB Mail Logs

If you use SQL Server Database mail sometimes you will have trouble and you want to see a log of all the emails that have been sent or failed to send.

To do this there are some management views that will help check what has been going on:

[sql]
select * from msdb.dbo.sysmail_allitems
Order By mailitem_id desc

select * from msdb.dbo.sysmail_faileditems;
[/sql]

Note Also if you need to force a restart of the DBMail service, then use the following:

[sql]
exec msdb.dbo.sysmail_stop_sp;
exec msdb.dbo.sysmail_start_sp;
[/sql]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.