如何使用存储过程发送电子邮件,并使用表中的receipents id [英] how to send email using a stored procedure,with receipents id's from a table
本文介绍了如何使用存储过程发送电子邮件,并使用表中的receipents id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用存储过程发送电子邮件以通知电子邮件ID有关错误。并且将从表格中获取邮件ID收据.plz指导我。
i need to send an email using a stored procedure to notify an email id about the error.and the mail id receipients are to be taken froma table .plz guide me over this.
推荐答案
阅读此博客
http:// www。 sqlteam.com/forums/topic.asp?TOPIC_ID=104042 [ ^ ]
按博客解决方案
Read this blog
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=104042[^]
Solution as per blog
DECLARE @Receipientlist varchar(8000)
SET @ReceipientList = STUFF((SELECT ';' + emailaddress FROM Your query here FOR XML PATH('')),1,1,'')
EXEC sp_send_dbmail @profile_name= your email profile in db,
@recipients=@Receipientlist,
@subject='your subject here',
@body='body message here'
...
这篇关于如何使用存储过程发送电子邮件,并使用表中的receipents id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文