Here's the last one I've got, it sends an Outlook E-mail Containing a Post-Integration Text Log
This one is an After Integration script and is probably closest the success script you were wanting.
'****************GET THE LOG FILE INFO******'*******************************************
'Set the path to the log files. Edit this line as appropriate
sLogPath="C:\IM\Logs\"
Set pFSO = CreateObject("Scripting.FileSystemObject")
Set pFolder = pFSO.GetFolder(sLogPath)
dtDateCreated=CDate("1/1/1900")
For Each File In pFolder.Files
If File.DateCreated > dtDateCreated then
dtDateCreated = File.DateCreated
sFileName=File.Name
End If
Next
'*******************************************
'************CREATE AND SEND THE E-MAIL*****
'*******************************************
'Edit the following line to indicate the e-mail address to
'which notification should be sent
sAddress = "adminstrator@mycompany.com"
'Set the subject line for the e-mail:
sSubject = "Integration Log"
'Generate the body of the e-mail
'Edit the following text as appropriate
sBody = "Log file attached for integration: Customers"
sBody = sBody & vbCrLf & vbCrLf
sBody = sBody & vbCrLf & "Date of Integration: " & Date()
sBody = sBody & vbCrLf & "Time of Integration: " & Time()
'Create an instance of Outlook & create an e-mail item
Set pOutlook=CreateObject("Outlook.Application")
Set pMAPI = pOutlook.GetNamespace("MAPI")
Set pMail = pOutlook.CreateItem(0)
'Set the recipient, subject & body of the e-mail
pMail.Recipients.Add(sAddress)
pMail.Subject = sSubject
pMail.Body = sBody
'Add an attachment
Set pAttachments = pMail.Attachments
pAttachments.Add sLogPath & sFileName
'Send the e-mail
pMail.Send
'Clean up
Set pMail = Nothing
Set pMAPI = Nothing
Set pOutlook = Nothing
Kind regards,
Leslie