Setup Mail SMTP




Right-Click on Database Mail, test email.



Setup Operator



Enable Mail Profile


Right-Click on SQL Server Agent, select Properties and enable mail profile in Alert System.



Setup Notification in Job


In Job properties, select Notification and enable E-mail.



Troubleshoot


USE msdb

GO


EXEC sp_configure 'show advanced', 1;  
RECONFIGURE;
EXEC sp_configure;
GO


-- Check DB Mail Service whether is active.

EXEC dbo.sysmail_help_status_sp



-- Check Mail Service Status

EXEC msdb.dbo.sysmail_help_queue_sp @queue_type = 'Mail';


-- List last 10 email queue
SELECT TOP 10 sent_status, *
FROM dbo.sysmail_allitems WITH(NOLOCK READUNCOMMITTED)
ORDER BY send_request_date desc



-- List email queue


Select count(*) from ExternalMailQueue


-- List email log


SELECT * FROM msdb.dbo.sysmail_event_log ORDER BY 1 DESC