Often we have scenarios to send the reports after execution of scripts via scripting. Here is an example...
Dim msg
Set msg = CreateObject("CDO.Message")
msg.From="abcd@gmail.com"
msg.To="efgh@gmail.com"
msg.Subject="Testing1 Sub"
msg.TextBody="Testing1 Body"
msg.AddAttachment("C:\\test.xls")
msg.AddAttachment("C:\\test.xls")
msg.Send
set msg=nothing
msgbox "Finished"
If you guys want to send with detailed things,
Refer CDO.Message Object reference...
Below lines are optional. But sometimes we need to add these lines to pass....
msg.Configuration.Fields.Item( "http://schemas.microsoft.com/ cdo/configuration/smtpserver") ="smtp.gmail.com"
msg.Configuration.Fields.Item( "http://schemas.microsoft.com/ cdo/configuration/ smtpserverport")=25
msg.Configuration.Fields.Item( "http://schemas.microsoft.com/ cdo/configuration/sendusing")= 2
msg.Configuration.Fields.Item( "http://schemas.microsoft.com/ cdo/configuration/ smtpauthenticate")= cdoAnonymous
'msg.Configuration.Fields. Item("http://schemas. microsoft.com/cdo/ configuration/smtpauthenticate ")=cdoBasic
'msg.Configuration.Fields. Item("http://schemas. microsoft.com/cdo/ configuration/sendUserName")=" "
'msg.Configuration.Fields. Item("http://schemas. microsoft.com/cdo/ configuration/sendpassword")=" "
msg.Configuration.Fields. update
Comments
Post a Comment