How do I know, when sending is ready???
I need to know, so I can disconnect the dial-up connection.
Thanks in advence
Andries
SCRIPT:
' Force explicit declaration of all variables.
Option Explicit
'***** DECLARATIONS*****************************
'Variables
Dim ReportFile, fName, objShell, oArgs
Dim strTo, strSubject, strBody
Dim objMail, iConf, Flds, i
'Constants
'Who the e-mail is from (this needs to have an e-mail address in it for the
e-mail to be sent)
Const strFrom = "from@emeel.org"
'Who the carbon copies are sent to
Const strCopy = "copy@emeel.org"
'Who the blind copies are sent to
Const strBCopy = ""
Const ReportPath = "C:\"
'Creates the main objects of the script
Set objShell = WScript.CreateObject("WScript.Shell")
Set objMail = Wscript.CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
'*****[ MAIN SCRIPT ]*****************************
Set oArgs = WScript.Arguments
For i = 0 to oArgs.Count - 1
ReportFile = oArgs(i)
Next
fName = ReportPath & ReportFile
'Who the e-mail is sent to
strTo = "to@emeel.net"
'Set the subject of the e-mail
strSubject = "Automatic on: "
'Set the main body of the e-mail
strBody = "AUTO"
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing").Value = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value =
"smtp.server"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport").Value= 25 .UpdateEnd WithSet objMail.Configuration = iConfobjMail.To = strToobjMail.CC = strCopyobjMail.BCC = strBCopyobjMail.From = strFromobjMail.Subject = strSubject & NowobjMail.TextBody = strBodyIf ReportFile <> "" Then objMail.AddAttachment(fName)End IfobjMail.Send'clean upSet Flds=nothingSet iConf=nothingSet objMail = NothingWScript.Quit