Friday, July 29, 2011

Send Email from SQL-Server Database

In order to send mail using Database Mail in SQL Server, there are 3 basic steps that need to be carried out. 1) Create Profile and Account 2) Configure Email 3) Send Email.

The following is the process for sending emails from database.

- Make sure that the SQL Server Mail account is configured correctly and enable Database Mail.

- Write a script to send an e-mail. The following is the script.

USE [YourDB]
EXEC msdb.dbo.sp_send_dbmail
@recipients = 'mathew@xyz.com; saadhya@xyz.com;anirudh@pqr.com’ 
@body = ' A warm wish for your future endeavor',
@subject = 'This mail was sent using Database Mail' ;
GO 

References:
http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/

Compiled By: Rajesh Rolen

Share This!


1 comment:

Anonymous said...

I know this if off topіc but I'm looking into starting my own weblog and was curious what all is required to get setup? I'm asѕumіng having a blog liκe уourѕ woulԁ cost a
pretty penny? I'm not very web savvy so I'm not 100% positive. Any tips or advice would be greatly appreciated. Appreciate it

Also visit my webpage %аnchοг_text%
My web site > chicken wings recipe

Powered By Blogger · Designed By Seo Blogger Templates