Database Mail Messaging Objects


Applies To: SQL Server 2016

The msdb database is the Database Mail host database. This database contains the stored procedures and messaging objects for Database Mail. Microsoft SQL Server Management Studio includes the Database Mail Configuration Wizard for enabling Database Mail, creating and managing profiles and accounts, and configuring Database Mail options.

Service Broker must be enabled in the msdb database. However, Database Mail does not use Service Broker networking. Therefore, users do not have to create a Service Broker endpoint to use Database Mail. The external Database Mail process uses a standard ADO.NET connection to communicate with SQL Server.

Database Mail exposes the following objects in the msdb database when Database Mail is enabled.

These objects are the interface for Database Mail within the mail host database. Other objects are installed to implement the functionality provided by the objects listed above. However, those objects are reserved for internal use.

sysmail_allitems (Transact-SQL)ViewLists all messages submitted to Database Mail.
sysmail_event_log (Transact-SQL)ViewLists messages about the behavior of the Database Mail External Program.
sysmail_faileditems (Transact-SQL)ViewInformation about messages that Database Mail could not sent.
sysmail_mailattachments (Transact-SQL)ViewInformation about attachments to Database Mail messages.
sysmail_sentitems (Transact-SQL)ViewInformation about messages that have been sent using Database Mail.
sysmail_unsentitems (Transact-SQL)ViewInformation about messages that Database Mail in currently trying to send.
sp_send_dbmail (Transact-SQL)Stored ProcedureSends e-mail messages using Database Mail.
sysmail_delete_log_sp (Transact-SQL)Stored ProcedureDeletes messages from the Database Mail log.
sysmail_delete_mailitems_sp (Transact-SQL)Stored ProcedureDeletes mail items from the Database Mail queue.
sysmail_help_status_sp (Transact-SQL)Stored ProcedureIndicates if Database Mail is started.
sysmail_start_sp (Transact-SQL)Stored ProcedureStarts the Service Broker objects that the external program uses. These objects are started by default.
sysmail_stop_sp (Transact-SQL)Stored ProcedureStops the Service Broker objects that the external program uses.


Database Mail
SQL Server Service Broker

Community Additions