Skip to main content

Read Outlook mail attachment and Body using Vb Script or QTP

Set olApp = CreateObject("Outlook.Application")
Set olns = olApp.GetNameSpace("MAPI")
Set ObjFolder = olns.GetDefaultFolder(6)
j = 0
For each item1 in ObjFolder.Items   
    iattachCnt = item1.Attachments.Count
    Print "Attachments Count: " & iattachCnt
    For i = 1 to iattachCnt
        Print "FileName :    " & item1.Attachments(i).FileName
        Print "Display Name:   " & item1.Attachments(i).DisplayName
        Print "Size: " & item1.Attachments(i).Size
    Next
    Print " Body : " & item1.body
    Print "--------------------------------------Mail Num - " & j & " -----------------------------------------------"
    j = j+1   
Next

Comments