user1202606
user1202606

Reputation: 1160

SSIS get emails from database and send individual emails

I need to schedule a task that runs monthly that will query sql server, get a list of emails, and send individual emails to everybody in the list.

I'm assuming I need to use SSIS to schedule the monthly task, but I'm not sure if I should be doing all of the work in sql server and use a stored procedure and the Database Mail, or if I should use SSIS to call a .Net executable that does all of the work?

Any suggestions on how to do this?

Upvotes: 0

Views: 738

Answers (2)

JonH
JonH

Reputation: 33153

Personally I have done the same types of things in SQL Server. You can setup SQL Mail and write a stored procedure that will pull the email addresses. Then you can simply use msdb.dbo.sp_send_dbmail and provide a profile name, a list of recipients, the subject, an attachment, etc all as options.

Then you can use the jobs section in sql server to run this sproc monthly, weekly, hourly, etc.

Upvotes: 1

rlobban
rlobban

Reputation: 343

SQL Authority has a good step by step on how to do this from within the database without using SSIS. http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/

After setting it up you can use SQL Agent to schedule a proc that processes and sends the email.

Upvotes: 0

Related Questions