Contains one row for each message processed by Database Mail. Use this view when you want to see the status of all messages.
To see only messages with the failed status, use sysmail_faileditems (Transact-SQL). To see only unsent messages, use sysmail_unsentitems (Transact-SQL). To see only messages that were sent, use sysmail_sentitems (Transact-SQL).
Identifier of the mail item in the mail queue.
The identifier of the profile used to send the message.
The e-mail addresses of the message recipients.
The e-mail addresses of those who receive copies of the message.
The e-mail addresses of those who receive copies of the message but whose names do not appear in the message header.
The subject line of the message.
The body of the message.
The body format of the message. The possible values are TEXT and HTML.
The importance parameter of the message.
The sensitivity parameter of the message.
A semicolon-delimited list of file names attached to the e-mail message.
The type of mail attachment.
The query executed by the mail program.
The database context within which the mail program executed the query.
When the value is 0, the query results were included in the body of the e-mail message, after the contents of the body. When the value is 1, the results were returned as an attachment.
When the value is 1, query results contained column headers. When the value is 0, query results did not include column headers.
The query_result_width parameter of the message.
The character used to separate columns in the query output.
The exclude_query_output parameter of the message. For more information, see sp_send_dbmail (Transact-SQL).
The append_query_error parameter of the message. 0 indicates that Database Mail should not send the e-mail message if there is an error in the query.
The date and time the message was placed on the mail queue.
The user who submitted the message. This is the user context of the database mail procedure, not the From: field of the message.
The identifier of the Database Mail account used to send the message.
The status of the mail. Possible values are:
The date and time that the message was sent.
The date and time of the last modification of the row.
The user who last modified the row.
Use the sysmail_allitems view to see the status of all messages processed by Database Mail. When troubleshooting Database Mail, this view may help you identify the nature of the problem, by showing you the attributes of the messages that were sent compared with the attributes of the messages that were not sent.
The system tables exposed by this view contain all messages and may cause the msdb database to grow. Delete old messages from the view periodically to reduce the size of the tables. For more information, see How to: Create a SQL Server Agent Job to Archive Database Mail Messages and Event Logs.