Tuesday, December 18, 2018

Send email through vbs using Outlook Application utility object

set objoutlookmail=createobject("outlook. application")
Set mymail=objoutlookmail. createitem(0)
mymail.display
set mymailproperty=objoutlookmail. activeinsepector
if mymailproperty. iswordmail="trur" then
    set mydoc=mymailproperty. wordeditor
    mydoc. range chr(13)+"Hi All," +chr(13) & " Please see execution status for.... application." +chr(13)
     mydoc.range.insertafter chr(13)+"Regards,"+chr(13) & "support team" +chr(13)
     strmailattachment="c:\test. html"
      mymail. Attachments. add strmailattachment
       mymail. from="abc@gmail.com"
       mymail. to="xyz@gmail.com;pyz@gmail.com"
      mymail. subject="Application Automation Execution Reports"
       mymail. send
end if
Set mymail.=Nothing
Set mydoc=Nothing
Set objoutlookmail=Nothing

No comments:

Post a Comment