| description | Send a test email with database mail | |||
|---|---|---|---|---|
| title | Send a test email with database mail | Microsoft Docs | |||
| ms.custom | ||||
| ms.date | 04/22/2019 | |||
| ms.prod | sql | |||
| ms.prod_service | database-engine | |||
| ms.reviewer | ||||
| ms.technology | ||||
| ms.topic | conceptual | |||
| helpviewer_keywords |
|
|||
| author | MashaMSFT | |||
| ms.author | mathoma |
[!INCLUDE SQL Server SQL MI]
Use the Send Test E-Mail dialog box to test the ability to send mail using a specific profile.
You must be a member of the sysadmin fixed server role to use the Send Test E-Mail dialog box. Users who are not members of the sysadmin fixed server role can test Database Mail using the sp_send_dbmail procedure.
-
Using Object Explorer in SQL Server Management Studio, connect to an instance of SQL Server Database Engine where Database Mail is configured, expand Management, right-click Database Mail, and then select Send Test E-Mail. If no Database Mail profiles exist, a dialog prompts the user to create a profile and opens the Database Mail Configuration Wizard.
-
In the Send Test E-Mail from <instance name> dialog box, in the Database Mail Profile box select the profile you want to test.
-
In the To box, type the e-mail name of the recipient of the test e-mail.
-
In the Subject box, type the subject line for the test e-mail. Change the default subject to better identify your e-mail for troubleshooting.
-
In the Body box, type to body of the test e-mail. Change the default subject to better identify your e-mail for troubleshooting.
-
Select Send Test E-Mail to send the test e-mail to the Database Mail queue.
-
Sending the test e-mail opens the Database Mail Test E-Mail dialog box. Make a note of the number displayed in the Sent e-mail box. This is the mailitem_id of the test message. Select OK.
-
On the Toolbar select New Query to open a Query Editor window. Run the following T-SQL statement to determine the status of the test e-mail message:
SELECT * FROM msdb.dbo.sysmail_allitems WHERE mailitem_id = <the mailitem_id from the previous step> ;
The sent_status column indicates if the test e-mail message was sent.
-
If errors occurred, execute the following statement to view the error message:
SELECT * FROM msdb.dbo.sysmail_event_log WHERE mailitem_id = <the mailitem_id from the previous step> ;