Database Mail Logging and Auditing
Database Mail is designed to help database administrators easily monitor Database Mail so that administrators can quickly isolate and correct problems. This topic describes the logging and auditing that Database Mail provides.
Tables in the msdb database log information from the Database Mail External Program. Database Mail Views (Transact-SQL) expose the tables for troubleshooting purposes. For example, errors appear in the sysmail_event_log (Transact-SQL) view if Service Broker cannot activate the external program, if the external program encounters networking errors or if the Simple Mail Transport Protocol (SMTP) server refuses an e-mail message. In the event that the external program cannot log to the msdb tables, the program logs errors to the Windows application event log.
Internal tables in the msdb database contain the e-mail messages and attachments sent from Database Mail, together with the current status of each message. Database Mail updates these tables as each message is processed. Query the sysmail_allitems, sysmail_sentitems, sysmail_unsentitems, and sysmail_faileditems views to check the delivery status of an individual e-mail message.
The sysmail_mailattachments view contains the e-mail attachments in Database Mail messages.
See Also