|This post explains the configuration steps that require to send an email from SQL server 2008 R2. It is useful if we could send an email from SQL Server to our administrators and end users. Database Mail is SQL server component that uses Simple Mail Transfer Protocol (SMTP) to send email messages. After setting up the Database email we can test the email and mail-log.|
1. Open the SQL server management studio and expand the Management node under the server
2. By default the mail configuration is disabled, we can enable by selecting the Database Mail item under Management. Right click the Database Mail and Click on Configure Database Mail
You will get the following wizard window after clicking on Configure Database Mail option
Click Yes to enable the Database Mail feature
3. Specify the profile name, description and associated SMTP account information as shown in the following windows
Add the SMTP account information by clicking on Add button from above dialogue box. In this case I have used my mail server details. You can replace with your SMTP mail address and credentials. After completion of entering the details in below windows just say ok
4. In the next step it will ask whether you want to set this profile as public. If you set this as public then any member under Database Mail role can send email using this profile.
5. Click Next in above window to get the Database Mail System parameters window, where you can configure parameter values like retry attempts, types of attachments that you do not want send out by mentioning the extensions of files in filters window.
6. You will get the successful configuration message after clicking on next button in above window
7. To test the configuration of Database Mail setup, Click on Send Test E-mail option by right clicking on Database Mail item under Management node.
you will see the following window. Enter the email address to test the email setup and click Send Test E-mail button.
8. To see the log details and status of the email, you can click on View Database Mail Log option
Now you can use this profile to send an email from Stored Procedure in SQL server. That’s it so simple to configure the Database Email, if you know the SMTP and a valid account name on the server.