Hi,
I've a 2003 server running MS SQL 2000, I'd like to fire an email to a
list
of users.
I've been trying to use a scheduled DTS package to do this.
I've set up a microsoft OLE DB connection to the database, followed by an
Execute SQL Task, then an ActiveX script task.
I've set the output in the sql task to pull the variables(UserEmaillist)
out
of it and it says it runs ok. But it can’t pass the global variable
UserEmaillist into “iMsg.To = "&'strUserEmaillist'&;"”
The following is the ActiveX script, any ideas?
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
dim strUserEmaillist
dim crlf
crlf = chr(13)&chr(10)
Set iMsg = createobject("CDO.Message")
strUserEmaillist = DTSGlobalVariables("UserEmaillist").Value
strFilename = "D:\Extracts\SourceCode\ExtensionRe****t.txt"
'**************************************************************
'Do not change this part
iMsg.Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").value
= "139.68.133.51"
iMsg.Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing").value
= 2
iMsg.Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver****t").value
= 25
iMsg.Configuration.fields.update
iMsg.MimeFormatted = False
iMsg.AutoGenerateTextBody = False
'Do not change this part
'**************************************************************
dim strFileName
'List the email addresses separated by commas
iMsg.To = "&'strUserEmaillist'&;"
iMsg.from = "wendy@[EMAIL PROTECTED]
"
iMsg.Subject = "Extensions going live"
iMsg.TextBody = "This is an automated email to notify you
that
these extensions are going live on the date which is showing in the
attached
file." &crlf & "Please contact Wendy( wendy@[EMAIL PROTECTED]
) for any" & crlf &
"issues."
'Duplicate this line for as many attachments as necessary
iMsg.AddAttachment(strFilename)
iMsg.Send
Main = DTSTaskExecResult_Success
End Function
------------------
Thanks,
Wendy