Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook 2007 pull info from email and send to another program

Status
Not open for further replies.

FNBIT

IS-IT--Management
Oct 27, 2006
74
0
0
US
Hey Everybody, I am very new to VBScript but I was wondering of it is possible to pull some info from an Outlook email containing a certain subject (specifically a URL contained in the body of a HTML email) then send this to another program? If you can point me in a direction or even if there is a commercial product that does this I would be gratefull.

Thanks!
 
here is something to get you started? i would advise running up the outlook vba gui thing, and then viewing the object model, it will give you the available properties of the Mail object

Set objApp = GetObject(, "Outlook.Application") '#### Find existing instance of Outlook
If Err Then
WScript.Quit() '#### If Outlook isn't running, quit the script
'Set objApp = CreateObject("Outlook.Application") '#### uncomment this & comment out above line to get data even if Outlook isnt running
End If
Set objOutlook = objApp.GetNameSpace("MAPI") '#### Get MAPI namespace

Set objInbox = objOutlook.GetDefaultFolder(6).Items
intA = 0
For Each aMail In objInbox
If LCase(CStr(aMail.Subject)) = "unsubscribe" Then
intA = intA + 1
'Wscript.Echo aMail.Subject & aMail.SenderEmailAddress
Wscript.Echo aMail.SenderEmailAddress
End If
Next

wscript.echo intA
 
something looping through mails with attachments...


Set objApp = GetObject(, "Outlook.Application") '#### Find existing instance of Outlook
If Err Then
WScript.Quit() '#### If Outlook isn't running, quit the script
'Set objApp = CreateObject("Outlook.Application") '#### uncomment this & comment out above line to get data even if Outlook isnt running
End If
Set objOutlook = objApp.GetNameSpace("MAPI") '#### Get MAPI namespace

Set objInbox = objOutlook.GetDefaultFolder(6).Items
intA = 0
For Each aMail In objInbox
Set myattachments = aMail.Attachments
If myattachments.Count > 0 Then
For Each aAttachment In myattachments
Wscript.Echo aMail.Subject & " " & aAttachment.DisplayName
aAttachment.SaveAsFile "G:\" & aAttachment.DisplayName
Next
End If
Next
 
Thanks guys! I will look into this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top