Microsoft® SQL Server 2008 R2 Unleashed
by Ray Rankins, Paul Bertucci, Chris Gallelli, Alex T. Silverstein
Viewing Mail Message Data
The second set of msdb objects (and perhaps the more important ones) we’ll review are those used to discover the status of mail messages.
The first thing you need to do is to check on the status of the mail messages you’ve attempted to send, without relying on inboxes to tell you if they’ve been received. Several views in msdb enable this, most of which may be filtered by mail account, sending user, send date, status, and more. To begin this process, you query the view sysmail_allitems, which contains all the data about your messages (subjects, recipients, importance, and so on) as well as send_request_date, sent_date, and sent_status. Here’s an example:
Because all these messages have a sent_status of sent, the contents ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access