E-Mail Functionality in SQL Server 2005
The final option is using a T-SQL script. The following script will enable the Database Mail option.
sp_configure ‘show advanced options’, 1;
sp_configure ‘Database Mail XPs’, 1; — 0 to Disable and 1 to enable
Configuring Database Mail
Now that we have examined the background of Database Mail, it is time to get your hands dirty with this new feature.
Right click the previously shown option in the screen shot above. If Database mail is not configured you will be asked to enable it with this wizard.
You will be taken to Database Mail Configuration window, which is shown below.
Even though there are four options in the windows, the first option is a combination of the other three options, so this article will focus on the first option.
You are required to create a Database Mail profile with a profile name and description. With a profile, as mentioned earlier, there can be multiple SMTP accounts.
The priority can be set by using the Move Up and Move Down buttons. According to the above example, the profile Dinesh will send mail via email@example.com. Failing that, it will send mail via firstname.lastname@example.org.
The following dialog gives you the option of configuring SMTP accounts. Apart from the basic SMTP account configuration, three authentications are available. The most commonly used authentication is basic authentication. You can configure your database authentication credentials to log into SMTP server. This is good practice. If you change your windows authentication, you do not have to change the Database Mail configuration.
Anonymous authentication is also available but not recommended for security reasons. If you are using this option, you will need to ensure that the mail server has not disabled anonymous authentication.