Dela via


Database Mail Accounts

A Database Mail account contains the information that Microsoft SQL Server uses to send e-mail messages to an SMTP server. Each account contains information for one e-mail server.

A Database Mail account is only used for Database Mail. A Database Mail account does not correspond to a SQL Server account or a Microsoft Windows account. Database Mail supports three methods of authentication to communicate with an SMTP server:

  • Windows Authentication: Database Mail uses the credentials of the SQL Server Database Engine Windows service account for authentication on the SMTP server.

  • Basic Authentication: Database Mail uses the username and password specified to authenticate on the SMTP server.

  • Anonymous Authentication: The SMTP server does not require any authentication. Database Mail will not use any credentials to authenticate on the SMTP server.

When creating a Database mail account, specify the authentication method required for each SMTP server.

Security noteSecurity Note

If your e-mail server requires authentication, consider creating a user on that SMTP server specifically for Database Mail. This user should have minimal permissions on the SMTP server, and should not be used for any other purpose.

Account information is stored in the msdb database. Each account consists of the following information:

  • The name of the account.

  • A description of the account.

  • The e-mail address of the account.

  • The display name for the account.

  • The e-mail address to use as the reply-to information for the account.

  • The name of the e-mail server.

  • The type of the e-mail server. For Microsoft SQL Server, this is always Simple Mail Transfer Protocol (SMTP).

  • The port number of the e-mail server.

  • A bit column indicating whether the connection to the SMTP mail server is made using Secure Sockets Layer (SSL).

  • A bit column indicating whether the connection to the SMTP server is made using the credentials configured for the SQL Server Database Engine.

  • The user name to use for authentication to the e-mail server, if the e-mail server requires authentication.

  • The password to use for authentication to the e-mail server, if the e-mail server requires authentication.

The Database Mail Configuration Wizard provides a convenient way to create and manage accounts. You can also use the configuration stored procedures in msdb to create and manage accounts.