.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson

Home >> Code Snippets >> SQL Query >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Send Mail with attachment in SQL Server 2008

Posted By:Sasi Prabhu       Posted Date: June 23, 2011    Points: 40    Category: SQL Query    URL: http://www.dotnetspark.com  

Sending Mail with Attachment using SQL Query in SQL Server.

Step 1 :

Configure Database Mail

Refer :


Step 2 :

Send Mail With Attachment

EXEC msdb.dbo.sp_send_dbmail @profile_name=, -- DatabaseMail ProfileName
  @recipients=,  -- To Address
  @subject=,  -- Mail Subject
  @body=, -- Mail Body
  @file_attachments= --File Location

Example :

EXEC msdb.dbo.sp_send_dbmail @profile_name='ProfileName',
  @subject='Test message',
  @body='This is the body of the test message. Congrates Database Mail Received By you Successfully.',


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend