Jaa


How to: Create a Database Mail Configuration Script Using Templates (SQL Server Management Studio)

Database Mail Configuration Wizard provides a convenient way to configure Database Mail. You can also use the templates provided with Microsoft SQL Server Management Studio to quickly produce a Transact-SQL script that creates a Database Mail profile and an account for that profile. For more information about Database Mail Configuration Wizard, see Database Mail Configuration Wizard.

To create a Database Mail configuration script by using templates

  1. On the View menu, select Template Explorer.

  2. In the Template Explorer window, expand the Database Mail folder.

  3. 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. Type values for the profile_name, account_name, SMTP_servername, email_address, and display_name. SQL Server Management Studio fills in the template with the values you provide.

  6. Execute the script to create the configuration.

Note

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. For more information about granting access to profiles, see sysmail_add_principalprofile_sp (Transact-SQL)

See Also

Tasks

How to: Create Database Mail Public Profiles (Transact-SQL)
How to: Create Database Mail Private Profiles (Transact-SQL)
How to: Create Database Mail Accounts (Transact-SQL)

Concepts

Database Mail

Other Resources

Database Mail Configuration Wizard
sysmail_add_principalprofile_sp (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance