Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 sending email

Author  Topic 

enak
Starting Member

34 Posts

Posted - 2006-09-13 : 14:16:04
I need to be able to send a number of emails to users. This needs to be done at 12:00am.

My database is hosted on a remote server that I don't have access to SQL Mail under support services but I do have access to email via DTS.

Can I create a stored procedure that will retrieve all of the records that need to be emailed (one record = one email) and send this out via the DTS package?

Thanks,
enak

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-09-13 : 17:46:23
You can do this via an ActiveX task (by writing some VBA script that calls the CDO libraries) or you can use the Send Email task in DTS. It's not as flexible as CDO but it should do the job.
Go to Top of Page

enak
Starting Member

34 Posts

Posted - 2006-09-15 : 14:44:55
I think that I need to use the send mail task in DTS but I do not know how to do this. I will be executing the DTS at around mid-night each night. There will be multiple emails sent out. Can I create a DTS package that will execute a stored procedure and for each record retrieved send an email to the recipient using Send Mail in DTS?
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-09-17 : 18:02:17
You probably could do that, but the standard Send Mail task will generally just email a dataset to a given address. I'm sure you could adapt it do do what you want, but I think it would be easier to code it in a stored proc and use xp_sendmail.
I'm not sure, but I suspect that the Send Mail task would use the same email gateway as is used by xp_sendmail. Assuming it's a hosted environment, can your service provider give you any specifics on how they prefer you to do it?

Go to Top of Page
   

- Advertisement -