Database Mail Messaging Objects

Applies to: yesSQL Server (all supported versions) YesAzure SQL Managed Instance

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.

Objects in msdb database

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.

Name Type Description
sysmail_allitems (Transact-SQL) View Lists all messages submitted to Database Mail.
sysmail_event_log (Transact-SQL) View Lists messages about the behavior of the Database Mail External Program.
sysmail_faileditems (Transact-SQL) View Information about messages that Database Mail could not sent.
sysmail_mailattachments (Transact-SQL) View Information about attachments to Database Mail messages.
sysmail_sentitems (Transact-SQL) View Information about messages that have been sent using Database Mail.
sysmail_unsentitems (Transact-SQL) View Information about messages that Database Mail in currently trying to send.
sp_send_dbmail (Transact-SQL) Stored Procedure Sends e-mail messages using Database Mail.
sysmail_delete_log_sp (Transact-SQL) Stored Procedure Deletes messages from the Database Mail log.
sysmail_delete_mailitems_sp (Transact-SQL) Stored Procedure Deletes mail items from the Database Mail queue.
sysmail_help_status_sp (Transact-SQL) Stored Procedure Indicates if Database Mail is started.
sysmail_start_sp (Transact-SQL) Stored Procedure Starts the Service Broker objects that the external program uses. These objects are started by default.
sysmail_stop_sp (Transact-SQL) Stored Procedure Stops the Service Broker objects that the external program uses.

See Also

Database Mail
SQL Server Service Broker