May 12, 2009

SQL SERVER: Configure Database Mail with SQL SERVER 2005

We used Database mail to send mail to client on each updates.

This is a very simple process to configure. Let me share how to configure Database mail with sql server 2005 with all of you.

After setting up Profile and Account properly, you just need to write following code to send a mail to client:

Step 1:

Configure Database Mail Step 1

Step 2:

Configure Database Mail Step 2

Step 3:

Configure Database Mail Step 3

Step 4: You might get this message:

Configure Database Mail Step 4

Step 5: Create Profile

Configure Database Mail Step 5

Step 6 : Create Account

Configure Database Mail Step 6

That's it.

exec msdb.dbo.sp_send_dbmail
@profile_name = 'ProfileName', IN our CASE, 'Tejas'
@recipients = 'Client Email Address' ,
@blind_copy_recipients = 'BCC Address',
@subject = 'Subject',
@BODY = 'Message Body',
@body_format = 'Message Type', it could be text OR html

Let me know if you have any complexity or comments in setting up Database mail.


3 comments:

  1. Thanks a lot for sharing such a important feature with every one,you people are really doing great job... I follow the process that you have explained, when execute sp_send_dbmail procedure I got the message "Mail queued." in my query window, and did not receive the test message in my mail box, why?

    ReplyDelete
  2. Hi Ekta,

    What is the server you are using ?

    Make sure you can send mails from that server.

    Tejas
    SQL Yoga

    ReplyDelete
  3. wanting to send a mass email but need to send as both text & htmls without sending the message twice to each individual. Is this possible with SQL Database Mail?

    ReplyDelete