November 28, 2005 at 2:37 pm
need help
how to paste a Value
of a "new file name after Rename" to the DTS MAIL
to send the new file name ATTACH by DTS MAil
with this code
----------------------
Rename File from Connection
Option Explicit
Function Main()
Dim oPkg
Dim oConn
Dim oFSO
Dim oFile
Dim sFilename
' Get reference to the current Package object
Set oPkg = DTSGlobalVariables.Parent
' Get reference to the named connection
Set oConn = oPkg.Connections("Text File (Source)")
' Get the filename from the connection
sFilename = oConn.DataSource
' Rename the file
Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.MoveFile sFilename, sFilename & ".bak"
' Clean Up
Set oConn = Nothing
Set oPkg = Nothing
Set oFSO = Nothing
Main = DTSTaskExecResult_Success
End Function
------------------------
thnks
ilan
November 29, 2005 at 6:46 am
You can try to write the file name, with full path, into the FileAttachment property of the SendMail Task. If you need to attach more than one file, just write the file names delimited by comma or semicolon (with my system configuration, semicolon is the choice, but I'm in Argentina, so that is the default delimiter).
if you need to modify the others properties, just look in Disconnected Edit for the correct names and type
Here is an ActiveScript that do the job:
Option Explicit
Function Main()
' ********************************************************************
' Modifica las propiedades de la tarea SendMail ' (that's the latin touch)
********************************************************************
' ***************************************************
' Variable declarations
' ***************************************************
Dim tskMail 'Mail
Dim strFiles 'Files to send
'Declare the Sendmail task
Set tskMail = pkg.Tasks("DTSTask_DTSSendMailTask_1").CustomTask
strFiles = "C:\readme.txt" 'File to send
'Body of the mail message
tskMail.MessageText = "Envio del archivo " & strFiles
'Attach the files
'tskMail.FileAttachments = strFiles
Main = DTSTaskExecResult_Success
End Function
Hope this helps.
Regards,
Andrés
November 29, 2005 at 9:48 am
i am new in dts
how i can add the option to send the email
profile name :
To:
CC:
Message
----
and with the ATTACHMENTS (new file)??
thnks
ilan
November 29, 2005 at 10:05 am
Sorry, I supposed that you already have the Sendmail Task configured.
To to this, you have to add a SendMail Task to the workflow and use the previous script before.
To use the Sendmail Task, you need an Email account and a profile configure in your machine, and the same (with the same Profile name) in the server for the account of the SQL Server Agent.
When I'd use it for the first time, I did some searches in order to figure it out how to get all this stuff working.
Please contact me if you need more specific help.
Regards,
Andrés
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply