My Blog List

Monday, June 27, 2011

Send Mail from Automation Scripting


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.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/smtpauthenticate")=cdoAnonymous
'msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=cdoBasic
msg.Configuration.Fields.update

1 comment:

  1. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium

    ReplyDelete