August 23, 2006 at 6:19 am
We have been using a simple e-mail program called "Blat" that uses SMTP. You can create scripts via the dts package to select the data into a file for the body of the e-mail, a script to send to one or multiple recipients and the csv file. The command syntax is simple:
C:\Email\blat C:\Email\EmailBody.txt -subject "Your Subject Line" -to email@email.com -attach "C:\Email\YourFile.csv"
If you are running SMTP services on your server already you can use sql mail or execute sp_send_cdosysmail or use the following SQL:
DECLARE @CDO int, @OLEResult int, @Out int
EXECUTE @OLEResult = sp_OACreate 'CDONTS.NewMail', @CDO OUT
IF @OLEResult <> 0 PRINT 'CDONTS.NewMail'
EXECUTE @OLEResult = sp_OAMethod @CDO,
'Send',
Null,
'e-mail test...',
'CDO database e-mail test.',
1
IF @OLEResult <> 0 PRINT 'error: ' + CONVERT(VARCHAR(64),@OLEResult)
EXECUTE @OLEResult = sp_OADestroy @CDO
August 23, 2006 at 11:04 am
August 24, 2006 at 7:12 am
Or, if you can't get that sorted out (I can never get it to work on our system)
http://sqldev.net/xp/xpsmtp.htm
Cheers
John
-------------------------------------------------------------------------
Normal chaos will be resumed as soon as possible. :crazy:
Viewing 3 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply