No new comments.
View All Comments
No new messages.
View All Messages
No new notifications.
View All Notifications
LEARN: Introduction to Entity Framework
An Interview Question
Ask a Question
Coding Best Practices
Universal Windows Platform
VR and AR
Databases & DBA
Design Patterns & Practices
Internet & Web
Internet of Things
C, C++, MFC
Request a new Category
Database Mail Configuration in SQL Server 2008
Part 1 of this article explain step by step, how to configure Database Mail in SQL Server 2008.
Remember SQL Mail?
SQL Mail was introduced in SQL Server 2000. Those who worked on SQL Mail know how much they hate it. They have to do Outlook configurations, third party Simple Mail Transfer Protocol mapping, Messaging Application Programming Interface profiles (this mapping must also be installed on production server) etc... etc..., lots of stuff must be ready for sending and receiving mails. I also got a chance to work with SQL Mail, it looks simple, but a lot of this kind of configuration must be there to get it working. One of the main disadvantages was when SQL Mail goes down; SQL Server also goes down because SQL Mail runs in-process to the SQL Server service. And also, SQL Mail is less secure. Even Microsoft has fully explained this in the
on Common SQL Mail problems.
Getting Started with Database Mail
Database Mail was introduced in SQL Server 2005 and we can say it is a complete replacement of SQL Mail of SQL Server earlier version. Database Mail is designed for reliability, scalability, security, and supportability.
The following is a list of some of the advantages of using Database Mail.
It's easy to configure, fast and reliable.
Auditing and Maintaining Logs of every mail.
Can be configured to multiple SMTP servers.
Can send HTML messages, attachments (can filter out attachments depend on extension).
No worry of SQL Server going down when Database Mail goes down because Database Mail runs outside SQL Server in a separate process.
Database Mail does not need any configuration like SQL Mail must have.
Fully supported on 64-bit installations of SQL Server.
By default Database Mail is not active. By using the Database Mail Configuration Wizard or the sp_configure stored procedure or by using the Surface Area Configuration facet of Policy-Based Management we can activate or configure it. Database Mail Configuration, security information, creating profiles and account, messaging components, executables, Logging and auditing information's will be saved in the MSDN database.
How to configure Database Mail
Open and login into your server with SQL Server Management Studio. Now press F8 or click on Object Explorer. Under Management node list you will see Database Mail node.
Now right-click on Configure Database Mail.
A welcome wizard will pop-up for configuration. You can read the information provided and click on Next. On the second window choose the first option from radio button list for configuration task.
Next comes the New Profiles creation window, here we can configure multiple SMTP configurations. If any of the account fails while sending mails, the profile uses the next account in the priority list. Add the profile name, description (optional) and click Add.
A New Database Mail Account window will be opened. Am using here as the server name as smtp.gmail.com and port number 587. You can configure other SMTP account also. Select Basic authentication and provide Gmail user name and password. Click OK and the profile account got created. We can even remove the profiles from the list available. Click on Next.
Manage Profile Security window where we can make profile as Public or Private. A Public profile can be accessed by all users of any mail-host database. A Private profile can only be accessed by a specific of any mail-host database from the User name dropdown list provided. We can even make default profiles. This part is optional and we are moving to next window.
Configure System parameters, this is also optional.
Click Next and Finish Completing the Configuration Wizard.
And the configuration is successful and now ready to test it.
Right-click on Database Mail then Send Test E-Mail from Object Explorer.
The Send Test E-Mail window will be opened. Enter email in "To" box, subject and hit Send.
We can even check the Database Mail Logs from Object Explorer.
Now open your mail inbox and check the mail received.
That's it; the Database Mail has been successfully configured.
This Part 1 article explained step by step, how to configure Database Mail in SQL Server 2008. Next part will cover how to programatically send mails, attach files, and send HTML format messages. Hope you all enjoyed the article. Post your comments and rate the article. For any queries our forum is available.
Thank you, have a nice day!
Database Mail Configuration in SQL Server 2008
Mail Configuration in SQL Server 2008
SQL Server 2008
What's New In Visual Studio 2017
Learn MongoDB Step By Step
Experience The New Features In Visual Studio 2017
Basic Information And Overview Of Visual Studio 2017
Visual Studio 2017 New Features
Introduction To Azure Machine Learning Studio
Learn Basics Of MVC Using AngularJS
Basic Operations In SharePoint 2013 Using PowerShell