简体   繁体   English

我们如何使用SQL Server(SSIS,SSRS或SQL AGENT)向500人发送带有附件的电子邮件

[英]How can we send email with an attachment to 500 people using SQL Server (SSIS, SSRS or SQL AGENT)

I need your advice. 我需要你的建议。 How can we send email with an attachment to 500 users. 我们如何向500个用户发送带有附件的电子邮件。 We are using SQL Server 2008 R2 Enterprise edition in our company. 我们在公司中使用SQL Server 2008 R2企业版。

I had tried using the Send Mail task from SSIS, but seems we can send maximum of 18 recipients due to the constraint in To: Cc: Bcc: . 我曾尝试使用SSIS中的“ Send Mail任务,但由于“收件人To: Cc: Bcc:的限制,似乎我们最多可以发送18个收件人。

Is there any way we can send using SQL Agent or SSRS ?? 有什么方法可以使用SQL Agent或SSRS发送?

I have another doubt regarding SSRS report subscription recipients. 对于SSRS报告订阅收件人,我还有另一个疑问。

To how many maximum number of recipients we can send report using subscription. 我们可以使用订阅发送报告的最大收件人数。 The reason i am asking this second is if i can send a report to 500 users by using SSRS report subscription then i can use SSRS. 我要问的原因是如果我可以通过使用SSRS报告订阅将报告发送给500个用户,那么我可以使用SSRS。

Thanks for your time!! 谢谢你的时间!!

I would just use Database Mail feature and write your own T-SQL code to send the email using Database Mail . 我只会使用数据库邮件功能并编写自己的T-SQL代码来使用数据库邮件发送电子邮件。 The sp_send_dbmail @recipients parameter you would use to pass in a delimited list is type varchar(max) so I am sure it can handle your 500 email address. 您将用于传递定界列表的sp_send_dbmail @recipients参数为varchar(max)类型,因此我确定它可以处理您的500个电子邮件地址。 I cannot find anything on MSDN that states a limit other than the data type limit. 我在MSDN上找不到任何说明了数据类型限制以外的限制的内容。

I would probably stick with SQL Agent in this instance if it is going to be repeated. 如果要重复,在这种情况下,我可能会坚持使用SQL Agent。

EDIT 编辑
As suggested by Brian in the comments, you probably do want to use the @blind_copy_recipients , which has the same data type. 正如Brian在评论中建议的那样,您可能确实想使用@blind_copy_recipients ,它具有相同的数据类型。

Actually SSRS would work quite nicely. 实际上,SSRS可以很好地工作。 We send out about 4000-5000 emailed reports using a SSRS every few weeks. 我们每隔几周就会使用SSRS发送大约4000-5000封电子邮件报告。

Create a report that will produce your attachment. 创建一个将生成附件的报告。 Create a query providing email addresses and any report parameters. 创建一个提供电子邮件地址和任何报告参数的查询。 Next create a data driven subscription using your query. 接下来,使用查询创建数据驱动的订阅。 You should be able to scale to thousands of recipients as needed. 您应该能够根据需要扩展到成千上万的收件人。

您可以编写一个游标,该游标遍历所有收件人并一次向一个收件人发送电子邮件...即使您从未编写过游标,也不难按照帮助中的示例进行操作...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM