简体   繁体   中英

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. We are using SQL Server 2008 R2 Enterprise edition in our company.

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: .

Is there any way we can send using SQL Agent or SSRS ??

I have another doubt regarding SSRS report subscription recipients.

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.

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 . 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. I cannot find anything on MSDN that states a limit other than the data type limit.

I would probably stick with SQL Agent in this instance if it is going to be repeated.

EDIT
As suggested by Brian in the comments, you probably do want to use the @blind_copy_recipients , which has the same data type.

Actually SSRS would work quite nicely. We send out about 4000-5000 emailed reports using a SSRS every few weeks.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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