Database Mail XP 伺服器組態選項Database Mail XPs Server Configuration Option

適用於: 是SQL Server 否Azure SQL Database 否Azure Synapse Analytics (SQL DW) 否平行處理資料倉儲 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

使用 [DatabaseMail XP] 選項,可在此伺服器上啟用 Database Mail。Use the DatabaseMail XPs option to enable Database Mail on this server. 可能的值為:The possible values are:

  • 0:無法使用 Database Mail (預設值)。0: Database Mail isn't available (default).

  • 1:可以使用 Database Mail。1: Database Mail is available.

設定立即生效,伺服器不必停止再重新啟動。The setting takes effect immediately without a server stop and restart.

啟用 Database Mail 後,您必須設定 Database Mail 主機資料庫來使用 Database Mail。After enabling Database Mail, you must configure a Database Mail host database to use Database Mail.

使用 [Database Mail 設定精靈] 設定 Database Mail,可啟用 msdb 資料庫中的 Database Mail 擴充預存程序。Configuring Database Mail using the Database Mail Configuration Wizard enables the Database Mail extended stored procedures in the msdb database. 如果您使用 [Database Mail 設定精靈] ,就不需使用以下的 sp_configure 範例。If you use the Database Mail Configuration Wizard, you do not have to use the sp_configure example below.

將 [Database Mail XP] 選項設為 0,會使 Database Mail 無法啟動。Setting the Database Mail XPs option to 0 prevents Database Mail from starting. 如果 Database Mail 在該選項設為 0 時仍在執行中,則會繼續執行並傳送郵件,直到 DatabaseMailExeMinimumLifeTime 選項所設定的時間才會閒置。If it is running when the option is set to 0, it continues to run and send mail until it is idle for the time configured in the DatabaseMailExeMinimumLifeTime option.


下列範例會啟用 Database Mail 擴充預存程序。The following example enables the Database Mail extended stored procedures.

sp_configure 'show advanced options', 1;  
sp_configure 'Database Mail XPs', 1;  

下列範例會啟用 Database Mail 擴充預存程序 (如果尚未啟用)。The following example enables the Database Mail extended stored procedures if it is not already enabled.

    SELECT 1 FROM sys.configurations 
    WHERE NAME = 'Database Mail XPs' AND VALUE = 0)
  PRINT 'Enabling Database Mail XPs'
  EXEC sp_configure 'show advanced options', 1;  
  EXEC sp_configure 'Database Mail XPs', 1;  

另請參閱See Also

Database MailDatabase Mail