Configure Database Mail
- Right-click ‘Database Mail’ (under ‘Management’) and select Configure Database Mail
- Follow instructions and setup a New Profile
- Continue, selecting your new profile as the Default
- Send test email:
USE msdb;
GO
EXEC sp_send_dbmail @profile_name='Profile_Name',
@recipients='youremail@Example.com',
@subject='Test message',
@body='This is the body of the test message.'
GO
EXEC sp_send_dbmail @profile_name='Profile_Name',
@recipients='youremail@Example.com',
@subject='Test message',
@body='This is the body of the test message.'
NB. When you want SQL Server Agent to send you Notifications (e.g. when a job fails) you need to add yourself as an Operator and restart the agent
You can track the delivery status of an individual message using the following views:
- dbo.sysmail_allitems
- dbo.sysmail_sentitems
- dbo.sysmail_unsentitems
No comments:
Post a Comment