SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sending Email in SQL Server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

183 Posts

Posted - 02/09/2013 :  01:49:53  Show Profile  Reply with Quote
Hi Experts,

if I run one Query then I will get this result:
select responsibleprovider ,emailaddress from table1
responsibleprovider emailaddress
aaaa, bbbbb aaaar@uphs.upenn.edu
ddddd, Pppp ddddp@uphs.upenn.edu

if I run another query I get this result:
select Count ,responsibleprovider from tablereport

Count responsibleprovider
6 aaaa, bbbbb
8 ddddd, Pppp

I need to send this people email about the number of reports waiting for them (knowing their email address from the previous SQL):

For example, contact Email will get email: You have 1 report
aaaa, bbbbb will get email: You have 4 reports

I am new to Mail functionality in SQL Server ,
Could you please advice me , how to send an mail to repective preoviders with some text.



Edited by - Ranjit.ileni on 02/09/2013 01:51:13

Flowing Fount of Yak Knowledge

United Kingdom
2124 Posts

Posted - 02/09/2013 :  06:52:34  Show Profile  Visit jackv's Homepage  Reply with Quote
SQL Server comes with Database Mail. Use this article to assist in setting up Database Mail , which will allow you to send email from within your sql statements. You will need a valid smtp address to which you can point

Jack Vamvas
Go to Top of Page

Very Important crosS Applying yaK Herder

52325 Posts

Posted - 02/09/2013 :  08:24:56  Show Profile  Reply with Quote
you can also implement this in ssis using send mail task. Just add a connection to your email server and it will sent the mail.

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000