Wednesday, May 20, 2009

MS Outlook Objcet Model : Send Email with Attachments

Set myOLApp = CreateObject("Outlook.Application")
Set myNameSpace = myOLApp.GetNameSpace("MAPI")
Set olMail = myOLApp.CreateItem(olMailItem)
set WshShell = CreateObject("WScript.Shell")

attachFile = "C:\test.txt"
With olMail
.to =""
.Subject = "Test Mail from QTP with Attachments"
.Body = "This is mail"
.NoAging = True
.Display
End With

Set myAttach = olMail.Attachments
myAttach.Add(ResFile)
'To avoid the display of modal dialog when trying to send email, use shortcut key CTRL S'
WshShell.SendKeys "%{s}"
Set myAttachments = Nothing
Set olMail = Nothing
Set myOLApp = Nothing

2 comments:

theslo said...

Visit Your URL replica ysl handbags go to this site buy replica bags online blog link buy replica bags online

nydu said...

my website replica bags philippines greenhills Chrome-Hearts Dolabuy replica kipling bags check this link right here now replica goyard bags