November 24, 2004 at 9:03 pm
Hi Guys
I am really, really new to SQL Server and really need some help.
I want to write a procedure that is scheduled to run on a daily basis.
The query needs to performa simple query on one table and then send an email to particular users based on the query results.
Basically, I really just need some help on how to email from a procedure. I've trolled round the net and found some code but none of it works (even though it compiles).
Can someone give me some really easy simple help on how to send an email.
As I've already said, I have never used SQL Server before.
Thank you so much in advance.
November 25, 2004 at 1:24 am
Hi,
you can any one of these two sp to send mail but for this outlook should be installed on your server.sometimes you can face some problem in outlook also.
Run your query and take the out put into variables and send mail.
EXEC MASTER.DBO.XP_SENDMAIL
@RECIPIENTS = @P_STRTO,
@MESSAGE = @P_STRBODY,
@QUERY = '',
@ATTACHMENTS = '' ,
@COPY_RECIPIENTS = '' ,
@BLIND_COPY_RECIPIENTS = '' ,
@SUBJECT = @P_STRSUBJECT
EXEC MASTER.DBO.sp_smtp_sendmail
@FROM = @P_STRTO,
,@FROM_NAME = N'GEAMSTDB01'
,@TO = @P_STRTO
,@message = @P_STRBODY
,@CC = ''
,@BCC = ''
,@subject = @P_STRSUBJECT
,@attachments = ''
November 25, 2004 at 1:41 am
See, if this helps:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;311231
http://support.microsoft.com/default.aspx?scid=kb;EN-US;315886
http://support.microsoft.com/default.aspx?scid=kb;EN-US;312839
http://support.microsoft.com/default.aspx?scid=kb;EN-US;263556
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply