Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 send mail sp

Author  Topic 

sqlpal2007
Posting Yak Master

200 Posts

Posted - 2008-09-11 : 09:44:58
Hello All,

I have to send an email to the group. Right now the job has invidual email ids in sp_send_dbmail. Instead can I use the group name and it should be able to send an email to the people in that group.

I have created a windows group (active directory) on the server level and added people in that group. How do I refer this group in the sp to send an email. Do I have to create login at the SQL server level?

Please advice,

Thanks,
-P

swekik
Posting Yak Master

126 Posts

Posted - 2008-09-11 : 15:08:33
Yes ,you have to add that group at the server level and include that group in sp_send_dbmail .
Go to Top of Page

lepeniotis
Yak Posting Veteran

75 Posts

Posted - 2008-09-12 : 08:22:50
Hi what I have done is creating a job with TSQL and and placed it at the end of the plans diagram here is the code that I found somewhere and it works fine with me. After any plan I have the job that informs me that this job done successfully.

DECLARE @Subject VARCHAR(100)
SET @Subject='subject of the mail'
+ cast(getdate() as VARCHAR(20))
exec msdb.dbo.sp_send_dbmail @profile_name = '<profilers name>', @recipients='mail address or group's mail address',
@body='whatever you want to write on the message', @Subject=@Subject
Go to Top of Page
   

- Advertisement -