Updated: June 10, 2016
Stops Database Mail by stopping the Service Broker objects that the external program uses.
|Applies to: SQL Server (SQL Server 2008 through current version).|
0 (success) or 1 (failure)
This stored procedure is in the msdb database.
This stored procedure stops the Database Mail queue that holds outgoing message requests and turns off Service Broker activation for the external program.
When the queues are stopped, the Database Mail external program does not process messages. This stored procedure allows you to stop Database Mail for troubleshooting or maintenance purposes.
To start Database Mail, use sysmail_start_sp. Notice that sp_send_dbmail still accepts mail when the Service Broker objects are stopped.
Execute permissions for this procedure default to members of the sysadmin fixed server role.
The following example shows stopping Database Mail in the msdb database. The example assumes that Database Mail has been enabled.
USE msdb ; GO EXECUTE dbo.sysmail_stop_sp ; GO