設定 Database MailConfigure Database Mail

本主題的適用對象: 是SQL Server沒有Azure SQL Database沒有Azure SQL 資料倉儲沒有Parallel Data WarehouseTHIS TOPIC APPLIES TO: yesSQL ServernoAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

本主題說明如何使用 Database Mail 組態精靈來啟用及設定 Database Mail,並使用範本建立 Database Mail 組態指令碼。This topic describes how to enable and configure Database Mail using the Database Mail Configuration Wizard, and create a Database Mail Configuration script using templates.

開始之前Before You Begin

使用 [DatabaseMail XP] 選項,可在此伺服器上啟用 Database Mail。Use the DatabaseMail XPs option to enable Database Mail on this server. 如需詳細資訊,請參閱 Database Mail XPs 伺服器組態選項 參考主題。For more information, see Database Mail XPs Server Configuration Option reference topic.

限制事項Limitations and Restrictions

在任何資料庫中啟用 SQL ServerSQL Server Service Broker 都需要資料庫鎖定。Enabling SQL ServerSQL Server Service Broker in any database requires a database lock. 如果已在 msdb中停用 Service Broker,則啟用 Database Mail 的第一步是停止 SQL ServerSQL Server Agent,好讓 Service Broker 可以取得必要的鎖定。If Service Broker was deactivated in msdb, to enable Database Mail, first stop SQL ServerSQL Server Agent so Service Broker can obtain the necessary lock.

安全性Security

若要設定 Database Mail,您必須是 系統管理員 固定伺服器角色的成員。To configure Database Mail you must be a member of the sysadmin fixed server role. 若要傳送 Database Mail,您必須是 msdb 資料庫之 DatabaseMailUserRole 資料庫角色的成員。To send Database Mail you must be a member of the DatabaseMailUserRole database role in the msdb database.

使用 Database Mail 組態精靈Using Database Mail Configuration Wizard

若要使用精靈設定 Database MailTo configure Database Mail using a wizard

  1. 在物件總管中,展開您想要設定 Database Mail 之執行個體的節點。In Object Explorer, expand the node for the instance you want to configure Database mail.

  2. 展開 [管理] 節點。Expand the Management node.

  3. 以滑鼠右鍵按一下 [Database Mail],然後按一下 [設定 Database Mail]。Right-click Database Mail, and then click Configure Database Mail.

  4. 完成精靈對話方塊Complete the Wizard dialogs

歡迎頁面Welcome Page

此頁說明設定 Database Mail 的步驟。This page describes the steps to configuring Database Mail.

不要再顯示此頁面 - 如果將來要略過此歡迎頁面,請核取此選項。Do not show this page again – Check this to skip this welcome page from displaying in the future.

下一步 - 繼續 [選取組態工作] 頁面。Next - Proceeds to the Select a configuration task page.

取消 - 結束精靈,而不設定 Database Mail。Cancel – Terminates the wizard without configuring Database Mail

Database Mail 組態精靈Database Mail Configuration Wizard

選取組態工作Select Configuration Task

使用 [選取組態工作] 頁面可指出您每次使用精靈時,會完成哪個工作。Use the Select Configuration Task page, to indicate which task you will complete each time you use the wizard. 如果您在完成精靈之前變更了主意,請使用 [上一步] 按鈕回到此頁面,然後選取不同的工作。If you change your mind before you complete the wizard, use the Back button to return to this page and select a different task.

注意

如果尚未啟用 Database Mail,您就會接收到訊息:[無法使用 Database Mail 功能。您要啟用此功能嗎?]If Database Mail has not been enabled, you will receive the message: The Database Mail feature is not available. Would you like to enable this feature? 回應 [是] 就相當於使用 sp_configure 系統預存程序的 Database Mail XP 選項來啟用 Database Mail。Responding Yes, is equivalent to enabling Database Mail by using the Database Mail XPs option of the sp_configure system stored procedure.

執行下列工作來設定 Database MailSet up Database Mail by performing the following tasks
執行第一次設定 Database Mail 所需的所有工作。Perform all of the tasks required to set up Database Mail for the first time. 此選項包含所有其他三個選項。This option includes all of the other three options.

管理 Database Mail 帳戶和設定檔Manage Database Mail accounts and profiles
建立新的 Database Mail 帳戶和設定檔,或是檢視、變更或刪除現有的 Database Mail 帳戶和設定檔。Create new Database Mail accounts and profiles or to view, change, or delete existing Database Mail accounts and profiles.

管理設定檔安全性Manage profile security
設定哪些使用者才能夠存取 Database Mail 設定檔。Configure which users have access to Database Mail profiles.

檢視或變更系統參數View or change system parameters
設定 Database Mail 系統參數,例如附件的檔案大小上限。Configure Database Mail system parameters such as the maximum file size for attachments.

Database Mail 組態精靈Database Mail Configuration Wizard

新增帳戶頁面New Account Page

使用這個頁面建立新的 Database Mail 帳戶。Use this page to create a new Database Mail account. Database Mail 帳戶包含傳送電子郵件到 SMTP 伺服器的資訊。A Database Mail account contains information for sending e-mail to an SMTP server.

Database Mail 帳戶包含 SQL ServerSQL Server 用來傳送電子郵件訊息到 SMTP 伺服器的資訊。A Database Mail account contains the information that SQL ServerSQL Server uses to send e-mail messages to an SMTP server. 每個帳戶包含一個電子郵件伺服器的資訊。Each account contains information for one e-mail server.

Database Mail 帳戶僅供 Database Mail 使用。A Database Mail account is only used for Database Mail. Database Mail 帳戶不會對應至 SQL ServerSQL Server 帳戶或 Microsoft Windows 帳戶。A Database Mail account does not correspond to a SQL ServerSQL Server account or a Microsoft Windows account. Database Mail 可以使用 SQL Server Database EngineSQL Server Database Engine的認證、使用您提供的其他認證或以匿名方式傳送。Database Mail can be sent using the credentials of the SQL Server Database EngineSQL Server Database Engine, using other credentials that you supply, or anonymously. 使用基本驗證時,Database Mail 帳戶中的名稱和密碼僅用於電子郵件伺服器的驗證。When using basic authentication, the user name and password in a Database Mail account are only used for authentication with the e-mail server. 帳戶不需要對應到 SQL ServerSQL Server 使用者,或在執行 SQL ServerSQL Server之電腦上的使用者。An account need not correspond to a SQL ServerSQL Server user or a user on the computer running SQL ServerSQL Server.

帳戶名稱Account name
輸入新帳戶的名稱。Type the name of the new account.

說明Description
輸入帳戶的描述。Type a description of the account. 描述是選擇性的。The description is optional.

電子郵件地址E-mail address
鍵入帳戶電子郵件地址的名稱。Type the name of the e-mail address for the account. 這是電子郵件傳送來自的電子郵件地址。This is the e-mail address that e-mail is sent from. 例如, SQL ServerSQL Server Agent 的帳戶可能會從 SqlAgent@Adventure-Works.com。For example, an account for SQL ServerSQL Server Agent may send e-mail from the address SqlAgent@Adventure-Works.com.

顯示名稱Display name
鍵入顯示於由這個帳戶傳送之電子郵件訊息上的名稱。Type the name to show on e-mail messages sent from this account. 顯示名稱是選擇性的。The display name is optional. 這是顯示於由這個帳戶傳送之訊息上的名稱。This is the name displayed on messages sent from this account. 例如, SQL ServerSQL Server Agent 的帳戶在電子郵件訊息上顯示的名稱可能會是「SQL Server Agent Automated Mailer」。For example, an account for SQL ServerSQL Server Agent may display the name "SQL Server Agent Automated Mailer" on e-mail messages.

回覆電子郵件Reply e-mail
鍵入將用來回覆給由這個帳戶傳送之電子郵件訊息的電子郵件地址。Type the e-mail address that will be used for replies to e-mail messages sent from this account. 回覆電子郵件是選擇性的。The reply e-mail is optional. 例如,回覆給 SQL ServerSQL Server Agent 帳戶的郵件,可能會傳送給資料庫管理員 danw@Adventure-Works.com。For example, replies to an account for SQL ServerSQL Server Agent may go to the database administrator, danw@Adventure-Works.com.

伺服器名稱Server name
輸入帳戶用來傳送電子郵件的 SMTP 伺服器名稱或 IP 位址。Type the name or IP address of the SMTP server the account uses to send e-mail. 一般而言,這會使用類似 smtp.<您的公司>.com 的格式。如需相關說明,請洽詢您的郵件管理員。Typically this is in a format similar to smtp.<your_company>.com. For help with this, consult your mail administrator.

通訊埠編號Port number
輸入此帳戶之 SMTP 伺服器的通訊埠編號。Type the port number of the SMTP server for this account. 多數的 SMTP 伺服器使用通訊埠 25。Most SMTP servers use port 25.

這個伺服器需要安全連接 (SSL)This server requires a secure connection (SSL)
使用安全通訊端層 (SSL) 將通訊加密。Encrypts communication using Secure Sockets Layer.

使用 Database Engine 服務認證的 Windows 驗證Windows Authentication using Database Engine service credentials
使用 SQL Server Database EngineSQL Server Database Engine 服務設定的認證,來建立 SMTP 伺服器的連接。Connection is made to the SMTP server using the credentials configured for the SQL Server Database EngineSQL Server Database Engine service.

基本驗證Basic Authentication
指定 SMTP 伺服器所需的使用者名稱和密碼。Specify the user name and password required by the SMTP server.

使用者名稱User name
鍵入 Database Mail 用來登入 SMTP 伺服器的使用者名稱。Type the user name that Database Mail uses to log in to the SMTP server. 如果 SMTP 伺服器需要基本驗證,則使用者名稱是必要的。The user name is required if the SMTP server requires basic authentication.

密碼Password
鍵入 Database Mail 用來登入 SMTP 伺服器的密碼。Type the password that Database Mail uses to log in to the SMTP server. 如果 SMTP 伺服器需要基本驗證,則密碼是必要的。The password is required if the SMTP server requires basic authentication.

確認密碼Confirm password
再次輸入密碼,以便確認密碼。Type the password again to confirm the password. 如果 SMTP 伺服器需要基本驗證,則密碼是必要的。The password is required if the SMTP server requires basic authentication.

匿名驗證Anonymous authentication
郵件傳送到 SMTP 伺服器時,不使用登入認證。Mail is sent to the SMTP server without login credentials. 當 SMTP 伺服器不需要驗證時,請使用此選項。Use this option when the SMTP server does not require authentication.

Database Mail 組態精靈Database Mail Configuration Wizard

管理現有的帳戶頁面Manage Existing Account Page

使用此頁面來管理現有的 Database Mail 帳戶。Use this page to manage an existing Database Mail account.

帳戶名稱Account name
選取要檢視、更新或刪除的帳戶。Select the account to view, update or delete.

刪除Delete
刪除選取的帳戶。Delete the selected account. 您必須從相關聯的設定檔移除這個帳戶,或先刪除相關聯的設定檔,再刪除選取的帳戶。You must remove this account from associated profiles, or delete such profiles, before you delete the selected account.

說明Description
檢視或更新帳戶的描述。View or update the description of the account. 描述是選擇性的。The description is optional.

電子郵件地址E-mail address
檢視或更新帳戶之電子郵件地址的名稱。View or update the name of the e-mail address for the account. 這是電子郵件傳送來自的電子郵件地址。This is the e-mail address that e-mail is sent from. 例如,Microsoft SQL Server Agent 的帳戶可能會從 SqlAgent@Adventure-Works.com之電腦上的使用者。For example, an account for Microsoft SQL Server Agent may send e-mail from the address SqlAgent@Adventure-Works.com.

顯示名稱Display name
檢視或更新名稱,以顯示在由這個帳戶傳送的電子郵件訊息上。View or update the name to show on e-mail messages sent from this account. 顯示名稱是選擇性的。The display name is optional. 這是顯示於由這個帳戶傳送之訊息上的名稱。This is the name displayed on messages sent from this account. 例如,SQL Server Agent 的帳戶在電子郵件訊息上顯示的名稱可能會是 SQL Server Agent Automated MailerFor example, an account for SQL Server Agent may display the name SQL Server Agent Automated Mailer on e-mail messages.

回覆電子郵件Reply e-mail
檢視或更新電子郵件地址,這將用於回覆給由這個帳戶傳送的電子郵件訊息。View or update the e-mail address that will be used for replies to e-mail messages sent from this account. 回覆電子郵件是選擇性的。The reply e-mail is optional. 例如,回覆給 SQL Server Agent 帳戶的郵件,可能會傳送給資料庫管理員 danw@Adventure-Works.com之電腦上的使用者。For example, replies to an account for SQL Server Agent may go to the database administrator, danw@Adventure-Works.com.

伺服器名稱Server name
檢視或更新帳戶用來傳送電子郵件的 SMTP 伺服器名稱。View or update the name of the SMTP server the account uses to send e-mail. 一般而言,此格式類似於 smtp.<貴公司>.com。如需相關說明,請洽詢您的郵件管理員。Typically this is in a format similar to smtp.<your_company>.com. For help with this, consult your mail administrator.

通訊埠編號Port number
檢視或更新此帳戶的 SMTP 伺服器的通訊埠編號。View or update the port number of the SMTP server for this account. 多數的 SMTP 伺服器使用通訊埠 25。Most SMTP servers use port 25.

這個伺服器需要安全連接 (SSL)This server requires a secure connection (SSL)
使用安全通訊端層 (SSL) 將通訊加密。Encrypts communication using Secure Sockets Layer.

使用 Database Engine 服務認證的 Windows 驗證Windows Authentication using Database Engine service credentials
使用 SQL Server Database EngineSQL Server Database Engine 服務設定的認證,來建立 SMTP 伺服器的連接。Connection is made to the SMTP server using the credentials configured for the SQL Server Database EngineSQL Server Database Engine service.

基本驗證Basic Authentication
指定 SMTP 伺服器所需的使用者名稱和密碼。Specify the user name and password required by the SMTP server.

User nameUser name
檢視或更新 Database Mail 用來登入 SMTP 伺服器的使用者名稱。View or update the user name that Database Mail uses to log in to the SMTP server. 如果 SMTP 伺服器需要基本驗證,則使用者名稱是必要的。The user name is required if the SMTP server requires basic authentication.

密碼Password
變更 Database Mail 用來登入 SMTP 伺服器的密碼。Change the password that Database Mail uses to log in to the SMTP server. 如果 SMTP 伺服器需要基本驗證,則密碼是必要的。The password is required if the SMTP server requires basic authentication.

確認密碼Confirm password
再次輸入密碼,以便確認密碼。Type the password again to confirm the password. 如果 SMTP 伺服器需要基本驗證,則密碼是必要的。The password is required if the SMTP server requires basic authentication.

匿名驗證Anonymous authentication
郵件傳送到 SMTP 伺服器時,不使用登入認證。Mail is sent to the SMTP server without login credentials. 當 SMTP 伺服器不需要驗證時,請使用此選項。Use this option when the SMTP server does not require authentication.

Database Mail 組態精靈Database Mail Configuration Wizard

新增設定檔頁面New Profile Page

使用此頁面可建立 Database Mail 設定檔。Use this page to create a Database Mail profile. Database Mail 設定檔是 Database Mail 帳戶的集合。A Database Mail profile is a collection of Database Mail accounts. 設定檔會在電子郵件伺服器無法連接時,提供替代的 Database Mail 帳戶,加強可靠性。Profiles improve reliability in cases where an e-mail server becomes unreachable, by providing alternative Database Mail accounts. 至少需要一個 Database Mail 帳戶。At least one Database Mail account is required. 如需在設定檔中設定 Database Mail 帳戶之優先權的詳細資訊,請參閱建立 Database Mail 設定檔For more information about setting the priority of Database Mail accounts in the profile, see Create a Database Mail Profile.

使用 [上移] 和 [下移] 按鈕,即可變更使用 Database Mail 帳戶的順序。Use the Move Up and Move Down buttons to change the order in which Database Mail accounts are used. 此順序是由一個值 (稱為序號) 決定。This order is determined by a value called the sequence number. [上移] 會減少序號,而 [下移] 會增加序號。Move Up lowers the sequence number and Move Down increases the sequence number. 序號決定了 Database Mail 使用設定檔中之帳戶的順序。The sequence number determines the order in which Database Mail uses accounts in the profile. 如果是新的電子郵件訊息,Database Mail 會從序號最低的帳戶開始。For a new e-mail message, Database Mail starts with the account that has the lowest sequence number. 如果這個帳戶失敗,Database Mail 會使用序號次高的帳戶,依此類推,直到 Database Mail 傳送訊息成功為止,或直到序號最高的帳戶失敗為止。Should that account fail, Database Mail uses the account with the next highest sequence number, and so on until either Database Mail sends the message successfully, or the account with the highest sequence number fails. 如果序號最高的帳戶失敗,Database Mail 會暫停嘗試傳送郵件一段時間,這段時間是在 Database Mail AccountRetryDelay 參數中設定,然後從最低序號開始,再次開始嘗試傳送郵件。If the account with the highest sequence number fails, the Database Mail pauses attempts to send the mail for the amount of time configured in the Database Mail AccountRetryDelay parameter, then starts the process of attempting to send the mail again, starting with the lowest sequence number. 使用 Database Mail AccountRetryAttempts 參數,即可設定外部郵件處理序使用指定之設定檔內的每個帳戶,嘗試傳送電子郵件訊息的次數。Use the Database Mail AccountRetryAttempts parameter, to configure the number of times that the external mail process attempts to send the e-mail message using each account in the specified profile. 您可以在 Database Mail 組態精靈的 [設定系統參數] 頁面上,設定 AccountRetryDelayAccountRetryAttempts 參數。You can configure the AccountRetryDelay and AccountRetryAttempts parameters on the Configure System Parameters page of the Database Mail Configuration Wizard.

設定檔名稱Profile name
輸入新設定檔的名稱。Type the name for the new profile. 系統會使用此名稱來建立設定檔。The profile is created with this name. 請勿使用現有設定檔的名稱。Do not use the name of an existing profile.

說明Description
鍵入設定檔的描述。Type a description for the profile. 描述是選擇性的。The description is optional.

SMTP 帳戶SMTP accounts
為設定檔選擇一或多個帳戶。Choose one or more accounts for the profile. 優先權會設定 Database Mail 使用這些帳戶的順序。The priority sets the order in which Database Mail uses the accounts. 如果沒有列出任何帳戶,您必須按一下 [加入] 才能繼續,然後加入新的 SMTP 帳戶。If no accounts are listed, you must click Add to continue, and add a new SMTP account.

[加入]Add
將帳戶加入至設定檔。Add an account to the profile.

移除Remove
從設定檔移除選取的帳戶。Remove the selected account from the profile.

上移Move Up
增加選取之帳戶的優先權。Increase the priority of the selected account.

下移Move Down
減少選取之帳戶的優先權。Decrease the priority of the selected account.

Database Mail 組態精靈Database Mail Configuration Wizard

管理現有的設定檔頁面Manage Existing Profile Page

使用此頁面可管理現有的 Database Mail 設定檔。Use this page to manage an existing Database Mail profile. Database Mail 設定檔是 Database Mail 帳戶的集合。A Database Mail profile is a collection of Database Mail accounts. 設定檔會在電子郵件伺服器無法連接時,提供替代的 Database Mail 帳戶,加強可靠性。Profiles improve reliability in cases where an e-mail server becomes unreachable, by providing alternative Database Mail accounts. 至少需要一個 Database Mail 帳戶。At least one Database Mail account is required. 如需在設定檔中設定 Database Mail 帳戶之優先權的詳細資訊,請參閱建立 Database Mail 設定檔For more information about setting the priority of Database Mail accounts in the profile, see Create a Database Mail Profile.

使用 [上移] 和 [下移] 按鈕,即可變更使用 Database Mail 帳戶的順序。Use the Move Up and Move Down buttons to change the order in which Database Mail accounts are used. 此順序是由一個值 (稱為序號) 決定。This order is determined by a value called the sequence number. [上移] 會減少序號,而 [下移] 會增加序號。Move Up lowers the sequence number and Move Down increases the sequence number. 序號決定了 Database Mail 使用設定檔中之帳戶的順序。The sequence number determines the order in which Database Mail uses accounts in the profile. 如果是新的電子郵件訊息,Database Mail 會從序號最低的帳戶開始。For a new e-mail message, Database Mail starts with the account that has the lowest sequence number. 如果這個帳戶失敗,Database Mail 會使用序號次高的帳戶,依此類推,直到 Database Mail 傳送訊息成功為止,或直到序號最高的帳戶失敗為止。Should that account fail, Database Mail uses the account with the next highest sequence number, and so on until either Database Mail sends the message successfully, or the account with the highest sequence number fails. 如果序號最高的帳戶失敗,Database Mail 會暫停嘗試傳送郵件一段時間,這段時間是在 Database Mail AccountRetryDelay 參數中設定,然後從最低序號開始,再次開始嘗試傳送郵件。If the account with the highest sequence number fails, the Database Mail pauses attempts to send the mail for the amount of time configured in the Database Mail AccountRetryDelay parameter, then starts the process of attempting to send the mail again, starting with the lowest sequence number. 使用 Database Mail AccountRetryAttempts 參數,即可設定外部郵件處理序使用指定之設定檔內的每個帳戶,嘗試傳送電子郵件訊息的次數。Use the Database Mail AccountRetryAttempts parameter, to configure the number of times that the external mail process attempts to send the e-mail message using each account in the specified profile. 您可以在 Database Mail 組態精靈的 [設定系統參數] 頁面上,設定 AccountRetryDelayAccountRetryAttempts 參數。You can configure the AccountRetryDelay and AccountRetryAttempts parameters on the Configure System Parameters page of the Database Mail Configuration Wizard.

設定檔名稱Profile name
選取要管理之設定檔的名稱。Select the name of the profile to manage.

刪除Delete
刪除選取的設定檔。Delete the selected profile. 系統會提示您選取 [是] 來刪除選取的設定檔,並將任何未送出的郵件設為失敗,或選取 [否],只有在沒有未送出的郵件時才刪除選取的設定檔。You will be prompted to select Yes to delete the selected profile and to fail any unsent messages, or to select No to delete the selected profile only if there are no unsent messages.

說明Description
檢視或變更選取之設定檔的描述。View or change the description of the selected profile. 描述是選擇性的。The description is optional.

SMTP 帳戶SMTP accounts
為設定檔選擇一或多個帳戶。Choose one or more accounts for the profile. 容錯移轉優先權會設定在發生容錯移轉時,Database Mail 使用帳戶的順序。The failover priority sets the order in which Database Mail uses the account in case of a failover.

[加入]Add
將帳戶加入至設定檔。Add an account to the profile.

移除Remove
從設定檔移除選取的帳戶。Remove the selected account from the profile.

上移Move Up
增加選取之帳戶的容錯移轉優先權。Increase the failover priority of the selected account.

下移Move Down
減少選取之帳戶的容錯移轉優先權。Decrease the failover priority of the selected account.

優先權Priority
檢視帳戶的目前容錯移轉優先權。View the current failover priority of the account.

帳戶名稱Account name
檢視帳戶的名稱。View the name of the account.

E-mail AddressE-mail Address
檢視帳戶的電子郵件地址。View the e-mail address of the account.

Database Mail 組態精靈Database Mail Configuration Wizard

Add Account to Profile PageAdd Account to Profile Page

使用此頁面可選擇要加入至設定檔的帳戶。Use this page to choose the account to add to the profile. 從 [帳戶名稱] 方塊中選擇現有的帳戶,或是按一下 [新增帳戶]Either choose an existing account from the Account name box, or click New Account.

帳戶名稱Account name
選取要加入至設定檔之帳戶的名稱。Select the name of the account to add to the profile.

電子郵件地址E-mail address
檢視選取之帳戶的電子郵件地址。View the e-mail address for the selected account. 您無法從此頁面中變更電子郵件地址。You cannot change the e-mail address from this page. 若要變更帳戶的電子郵件地址,請回到精靈的主要頁面,然後選取 [管理 Database Mail 帳戶和設定檔] 選項。To change the e-mail address for the account, go back to the main page of the wizard and select the Manage Database Mail accounts and profiles option.

伺服器名稱Server name
檢視選取之帳戶的郵件伺服器名稱。View the mail server name for the selected account. 您無法從此頁面中變更伺服器名稱。You cannot change the server name from this page. 若要變更帳戶的伺服器名稱,請回到精靈的主要頁面,然後選取 [管理 Database Mail 帳戶和設定檔] 選項。To change the server name for the account, go back to the main page of the wizard and select the Manage Database Mail accounts and profiles option.

新增帳戶New Account
建立新帳戶。Create a new account.

Database Mail 組態精靈Database Mail Configuration Wizard

管理帳戶和設定檔頁面Manage Accounts and Profiles Page

使用此頁面可選擇用來管理設定檔或帳戶的工作。Use this page to choose a task for managing a profile or account.

建立新帳戶Create a new account
建立新帳戶。Create a new account.

檢視、變更或刪除現有的帳戶View, change or delete an existing account
管理或刪除現有的帳戶。Manage or delete an existing account.

建立新設定檔Create a new profile
建立新的設定檔。Create a new profile.

檢視、變更或刪除現有的設定檔。您也可以管理與設定檔相關聯的帳戶。View, change or delete an existing profile. You can also manage accounts associated with the profile.
更新或刪除現有的設定檔。Update or delete an existing profile. 此選項也可讓您管理與設定檔相關聯的帳戶。This option also allows you to manage accounts associated with the profile.

Database Mail 組態精靈Database Mail Configuration Wizard

管理設定檔安全性、公用索引標籤Manage Profile Security, Public Tab

使用此頁面來設定公用設定檔。Use this page to configure a public profile.

設定檔是公用或私人的。Profiles are either public or private. 私人設定檔只有特定使用者或角色能夠存取。A private profile is accessible only to specific users or roles. 公用設定檔允許擁有郵件主機資料庫 (msdb) 存取權的任何使用者或角色,使用該設定檔傳送電子郵件。A public profile allows any user or role with access to the mail host database (msdb) to send e-mail using that profile.

設定檔可能是預設設定檔。A profile may be a default profile. 在此情況下,使用者或角色不必明確指定設定檔,就能使用設定檔傳送電子郵件。In this case, users or roles can send e-mail using the profile without explicitly specifying the profile. 如果傳送電子郵件訊息的使用者或角色有預設的私人設定檔,Database Mail 就會使用該設定檔。If the user or role sending the e-mail message has a default private profile, Database Mail uses that profile. 如果使用者或角色沒有預設的私人設定檔, sp_send_dbmail 會使用 msdb 資料庫的預設公用設定檔。If the user or role has no default private profile, sp_send_dbmail uses the default public profile for the msdb database. 如果沒有使用者或角色的預設私人設定檔,而且沒有資料庫的預設公用設定檔, sp_send_dbmail 會傳回錯誤。If there is no default private profile for the user or role and no default public profile for the database, sp_send_dbmail returns an error. 只有一個設定檔可以標示為預設的設定檔。Only one profile can be marked as the default profile.

公用Public
選取此選項使指定的設定檔成為公用的。Select this option to make the specified profile public.

Profile NameProfile Name
顯示設定檔的名稱。Displays the name of the profile.

預設設定檔Default Profile
選取此選項使指定的設定檔成為預設的設定檔。Select this option to make the specified profile the default profile.

只顯示現有的公用設定檔Show only existing public profiles
選取此選項,以便只顯示指定之資料庫中公用的設定檔。Select this option to show only public profiles in the specified database.

Database Mail 組態精靈Database Mail Configuration Wizard

管理設定檔安全性、私用索引標籤Manage Profile Security, Private Tab

使用此頁面來設定私人設定檔。Use this page to configure a private profile.

設定檔是公用或私人的。Profiles are either public or private. 私人設定檔只有特定使用者或角色能夠存取。A private profile is accessible only to specific users or roles. 公用設定檔允許擁有郵件主機資料庫 (msdb) 存取權的任何使用者或角色,使用該設定檔傳送電子郵件。A public profile allows any user or role with access to the mail host database (msdb) to send e-mail using that profile.

設定檔可能是預設設定檔。A profile may be a default profile. 在此情況下,使用者或角色不必明確指定設定檔,就能使用設定檔傳送電子郵件。In this case, users or roles can send e-mail using the profile without explicitly specifying the profile. 如果傳送電子郵件訊息的使用者或角色有預設的私人設定檔,Database Mail 就會使用該設定檔。If the user or role sending the e-mail message has a default private profile, Database Mail uses that profile. 如果使用者或角色沒有預設的私人設定檔, sp_send_dbmail 會使用 msdb 資料庫的預設公用設定檔。If the user or role has no default private profile, sp_send_dbmail uses the default public profile for the msdb database. 如果沒有使用者或角色的預設私人設定檔,而且沒有資料庫的預設公用設定檔, sp_send_dbmail 會傳回錯誤。If there is no default private profile for the user or role and no default public profile for the database, sp_send_dbmail returns an error.

User nameUser name
選取 msdb 資料庫中使用者或角色的名稱。Select the name of a user or role in the msdb database.

存取Access
選取使用者或角色是否能夠存取指定的設定檔。Select whether the user or role has access to the specified profile.

設定檔名稱Profile name
檢視設定檔的名稱。View the name of the profile.

是預設的設定檔Is Default Profile
選取設定檔是否是使用者或角色的預設設定檔。Select whether the profile is the default profile for the user or role. 每個使用者或角色只可以有一個預設的設定檔。Each user or role may have only one default profile.

只顯示此使用者的現有私人設定檔Show only existing private profiles for this user
選取此選項,只顯示指定之使用者或角色已經擁有存取權的設定檔。Select this option to display only profiles that the specified user or role already has access to.

Database Mail 組態精靈Database Mail Configuration Wizard

設定系統參數Configure System Parameters

使用此頁面來指定 Database Mail 系統參數。Use this page to specify Database Mail system parameters. 檢視系統參數以及每個參數目前的值。View the system parameters and the current value of each parameter. 選取參數,以便在資訊窗格中檢視簡短的描述。Select a parameter to view a short description in the information pane.

帳戶重試嘗試Account Retry Attempts
外部郵件處理序嘗試利用指定設定檔中的每個帳戶來傳送電子郵件訊息的次數。The number of times that the external mail process attempts to send the e-mail message using each account in the specified profile.

帳戶重試延遲 (秒)Account Retry Delay (seconds)
外部郵件處理序在使用設定檔中的所有帳戶,來嘗試傳遞訊息之後,其在再次嘗試使用所有帳戶之前,所需等候的時間 (以秒為單位)。The amount of time, in seconds, for the external mail process to wait after it tries to deliver a message using all accounts in the profile before it attempts all accounts again.

檔案大小上限 (位元組)Maximum File Size (Bytes)
附件的大小上限 (以位元組為單位)。The maximum size of an attachment, in bytes.

禁止的附加檔案副檔名Prohibited Attachment File Extensions
無法作為電子郵件訊息附件來傳送的副檔名清單 (以逗號分隔)。A comma-separated list of extensions which cannot be sent as an attachment to an e-mail message. 按一下瀏覽按鈕 ([...]),加入其他副檔名。Click the browse button (...) to add additional extensions.

Database Mail 可執行檔最小存留期間 (秒)Database Mail Executable Minimum Lifetime (seconds)
外部郵件處理序維持使用中的最短時間 (以秒為單位)。The minimum amount of time, in seconds, that the external mail process remains active. 只要在 Database Mail 佇列中有電子郵件,此處理序就會保持在使用中。The process remains active as long as there are e-mails in the Database Mail queue. 此參數指定當沒有要處理的訊息時,處理序保持在使用中的時間。This parameter specifies the time the process remains active if there are no messages to process.

記錄層級Logging level
指定哪些訊息要記錄在 Database Mail 記錄中。Specify which messages are recorded in the Database Mail log. 可能的值為:Possible values are:

  • 一般 - 只記錄錯誤Normal - logs only errors

  • 擴充 - 記錄錯誤、警告以及資訊性訊息Extended - logs errors, warnings, and informational messages

  • 詳細資訊 - 記錄錯誤、警告、資訊性訊息、成功訊息以及其他內部訊息。Verbose - logs errors, warnings, informational messages, success messages, and additional internal messages. 使用詳細資訊記錄來進行疑難排解。Use verbose logging for troubleshooting.

    預設值是擴充。Default value is Extended.

    全部重設Reset All
    選取此選項,將頁面上的值都重設為預設值。Select this option to reset the values on the page to the default values.

    Database Mail 組態精靈Database Mail Configuration Wizard

完成精靈頁面Complete the Wizard Page

使用此頁面來檢閱 [Database Mail 組態精靈] 將要執行的動作。Use this page to review the actions that Database Mail Configuration Wizard will perform. 在精靈結束之前將不會做任何變更。No changes are made until you finish the wizard.

Database Mail 組態精靈Database Mail Configuration Wizard

Send Test E-Mail PageSend Test E-Mail Page

透過 [從 <執行個體名稱> 傳送測試電子郵件]****** 頁面使用指定的 Database Mail 設定檔傳送電子郵件訊息。Use the Send Test E-Mail from<instance_name> page to send an e-mail message using the specified Database Mail profile. 只有 系統管理員 固定伺服器角色的成員,才可以使用此頁面來傳送測試電子郵件。Only members of the sysadmin fixed server role can send test e-mail using this page.

Database Mail 設定檔Database Mail Profile
從清單中選取 Database Mail 設定檔。Select a Database Mail profile from the list. 這是必要的欄位。This is a required field. 如果未顯示任何設定檔,就表示沒有設定檔,或者您沒有設定檔的存取權限。If no profiles are shown, there are no profiles or you do not have permission to a profile. 使用 [Database Mail 組態精靈] 來建立及設定設定檔。Use the Database Mail Configuration Wizard to create and configure profiles. 如果未列出任何設定檔,請使用 Database Mail 組態精靈來建立供您使用的設定檔。If no profiles are listed, use the Database Mail Configuration Wizard to create a profile for your use.

若要To
訊息收件者的電子郵件地址。The e-mail address of the message recipients. 至少需要一位收件者。At least one recipient is required.

主旨Subject
測試電子郵件的主旨列。The subject line for the test e-mail. 變更預設主旨,以便更適當地識別您的電子郵件進行疑難排解。Change the default subject to better identify your email for troubleshooting.

本文Body
測試電子郵件的本文。The body of the test e-mail. 變更預設主旨,以便更適當地識別您的電子郵件進行疑難排解。Change the default subject to better identify your email for troubleshooting.

[Database Mail 測試電子郵件] 對話方塊會確認 Database Mail 已嘗試傳送測試訊息,並提供測試電子郵件訊息的 mailitem_idThe Database Mail Test E-Mail dialog box confirms that the test message that Database Mail attempted to send the message and provides the mailitem_id for the test e-mail message. 與收件者聯繫來判斷電子郵件是否送達。Check with the recipient to determine if the e-mail arrived. 電子郵件一般都會在數分鐘內收到,但是電子郵件可能因為緩慢的網路效能、在郵件伺服器上積存訊息,或伺服器暫時不能使用等原因而延遲。Normally e-mail is received in a few minutes, but the e-mail can be delayed because of slow network performance, a backlog of messages at the mail server, or if the server is temporarily unavailable. 使用 mailitem_id 來進行疑難排解。Use the mailitem_id for troubleshooting.

傳送電子郵件Sent e-mail
測試電子郵件訊息的 mailitem_idThe mailitem_id of the test e-mail message.

疑難排解Troubleshoot
按一下以開啟《線上叢書》的 Database Mail 疑難排解主題。Click to open Books Online to the Troubleshooting Database Mailtopic.

Database Mail 組態精靈Database Mail Configuration Wizard

使用範本Using Templates

若要建立 Database Mail 組態指令碼To create a Database Mail configuration script

  1. 在 [檢視] 功能表中,選取 [範本總管]。On the View menu, select Template Explorer.

  2. 在 [範本總管] 視窗中,展開 [Database Mail] 資料夾。In the Template Explorer window, expand the Database Mail folder.

  3. 按兩下 [Simple Database Mail 組態]。Double-click Simple Database Mail Configuration. 就會在新查詢視窗中開啟範本。The template opens in a new query window.

  4. 在 [查詢] 功能表上,選取 [指定範本參數的值]。On the Query menu, select Specify Values for Template Parameters. 即會開啟 [取代範本參數] 視窗。The Replace Template Parameters window opens.

  5. 輸入 profile_nameaccount_nameSMTP_servernameemail_addressdisplay_name 的值。Type values for the profile_name, account_name, SMTP_servername, email_address, and display_name. SQL Server Management Studio 就會將您提供的值填入範本中。SQL Server Management Studio fills in the template with the values you provide.

  6. 執行指令碼以建立組態。Execute the script to create the configuration.

  7. 此指令碼不會將資料庫使用者存取權授與給設定檔。The script does not grant any database users access to the profile. 因此,依預設只有系統管理員固定安全性角色的成員才能使用此設定檔。Therefore, by default, the profile can only be used by members of the sysadmin fixed security role. 如需授與設定檔存取權限的詳細資訊,請參閱 sysmail_add_principalprofile_sp (Transact-SQL)For more information about granting access to profiles, see sysmail_add_principalprofile_sp (Transact-SQL)