articles

Home / DeveloperSection / Articles / Database Mail in SQL Server

Database Mail in SQL Server

Sumit Kesarwani6980 28-Nov-2014

In this article, I’m explaining how to setup database mail in sql server.

Database mail is used to send the email using SQL Server. it is replacement of SQLMail of SQL Server earlier version. Database Mail has many enhancement over SQLMail. Database Mail is based on SMTP (Simple Mail Transfer Protocol) and also very fast and reliable where as SQLMail is based on MAPI (Messaging Application Programming Interface). Database mail depends on Service Broker so this service must be enabled for Database Mail. Database Mail can be encrypted for additional security

Setup Database Mail

You can find the database mail in sql server under the management like this:

Database Mail in SQL Server

Right click on database mail and select configure database mail.

 

Database Mail in SQL Server

Database Mail in SQL Server

Database Mail in SQL Server

Database Mail in SQL Server

Database Mail in SQL Server

Database Mail in SQL Server

Database Mail in SQL Server

Database Mail in SQL Server

Database Mail in SQL Server

Database Mail in SQL Server

Database Mail in SQL Server


To Send a mail from Database Mail


Database Mail in SQL Server

Database Mail in SQL Server

If you want to send mail from the code:

use msdb
go
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'TestingDatabaseMail',
@recipients = 'praveshsinghfaq@gmail.com',
@subject = 'Test Mail',
@body = 'Testing E-Mail';

Database Mail in SQL Server

 


Leave Comment

Comments

Liked By