| title | sysmail_delete_account_sp (Transact-SQL) | ||
|---|---|---|---|
| description | Deletes a Database Mail SMTP account. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server - ASDBMI]
Deletes a Database Mail SMTP account. You can also use the Database Mail Configuration Wizard to delete an account.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sysmail_delete_account_sp { [ @account_id = ] account_id | [ @account_name = ] 'account_name' }
[ ; ]
The ID number of the account to delete. @account_id is int, with no default. Either @account_id or @account_name must be specified.
The name of the account to delete. @account_name is sysname, with no default. Either @account_id or @account_name must be specified.
0 (success) or 1 (failure).
None.
This procedure deletes the account specified, regardless of whether the account is in use by a profile. A profile that contains no accounts can't successfully send e-mail.
The stored procedure sysmail_delete_account_sp is in the msdb database and is owned by the dbo schema. The procedure must be executed with a three-part name if the current database isn't msdb.
[!INCLUDE msdb-execute-permissions]
The following example shows deleting the Database Mail account named AdventureWorks Administrator.
EXECUTE msdb.dbo.sysmail_delete_account_sp @account_name = 'AdventureWorks Administrator';- Database Mail
- Create a Database Mail account
- Database Mail Configuration Objects
- sysmail_add_account_sp (Transact-SQL)
- sysmail_delete_profile_sp (Transact-SQL)
- sysmail_delete_profileaccount_sp (Transact-SQL)
- sysmail_help_account_sp (Transact-SQL)
- sysmail_help_profile_sp (Transact-SQL)
- sysmail_help_profileaccount_sp (Transact-SQL)
- sysmail_update_profileaccount_sp (Transact-SQL)