Jump to content
Sign in to follow this  
Regency

Help readin emails using Outlook

Recommended Posts

Regency

Ok, I have an Outlook UDF that can be found on this site. I am unable to get a read out of the _arraydisplay, i am guessing because my outlooks messed up (Outlook 2003) My email inbox and such look like this.

-Personal Folders

-Deleted Items

-Drafts

-Inbox

-Junk E-mail

-Sent Mail

-Search Folders

-ScorpiA

-[Gmail]

-All Mail ---- This is where all my mail is thats new.

-Drafts

-Sent Mail

-Spam

-Starred

-Trash

-Inbox

I have used the demo part of the udf, and cant seem to get into the All Mail part of the outlook program. Can anyone provide some insight?

#Include "C:\Program Files\Autoit3\Include\Outlook.au3"
#include<array.au3>
$OL = _outlookopen()
$xx = _OutlookGetMail($OL,"[Gmail]" & "\All Mail","","","","","","RE:Captcha","",'',"",0)
_Arraydisplay($xx)

Share this post


Link to post
Share on other sites
Juvigy

Could you tell me in which folder is the email that you want to read and how do you identify it ? I guess this is the subject - "RE:Captcha"?

Share this post


Link to post
Share on other sites
Regency

Yeah, and the folder i need to get at is the "All Mail" Folder under the Scorpia \ [Gmail] \ Folders

Share this post


Link to post
Share on other sites
Juvigy

That should work:

Global $test,$test2

$oOApp = ObjCreate("Outlook.Application")
$myNamespace =$oOApp.GetNamespace("MAPI")
$myFolder = $myNamespace.GetDefaultFolder(5)

$myNewFolder = $myNamespace.Folders()

For $element in $myNewFolder
If  $element.Name=="[Gmail]" then $test=$element.Folders()
next

For $element in $test
If  $element.Name<>"All Mail" then ContinueLoop 
$test2=$element
next

$a=0
For $element in $test2
If  $element.Items($a).subject=="RE:Captcha" then MsgBox(0,"",$element.Items($a).Body) 
$a=$a+1
next

Edit: Forgot to increment the counter:)

Edited by Juvigy

Share this post


Link to post
Share on other sites
IQ9003

Thanks, this his solution works. :)

Do you know how to read sub-folders? I can't seem to adapt the script to read another sub-folder from the Inbox.

I want to read mail from these folders:

Mailbox_user => Inbox => Accepted

Mailbox_user => Inbox => Denied

Edit: Sorry, just after I was typing this i got it working.

Global $test,$test2, $test3
$oOApp = ObjCreate("Outlook.Application")
$myNamespace =$oOApp.GetNamespace("MAPI")
$myFolder = $myNamespace.GetDefaultFolder(5)
$myNewFolder = $myNamespace.Folders()

For $element in $myNewFolder
    If  $element.Name=="Mailbox_user" then $test=$element.folders()
next

For $element in $test
    If  $element.Name=="Inbox" then $test2=$element.folders()
next

For $element in $test2
    If  $element.Name=="Accepted" then $test3=$element
next

For $a = 1 to $test3.items.count
 If $test3.Items($a).subject="Fw:Mytest" then MsgBox(0,"Titel",$test3.Items($a).flagicon)
next
Edited by IQ9003

Share this post


Link to post
Share on other sites
water

A very good Outlook.udf can be found here. If it doesn't provide what you need it can at least give you an idea how to do it yourself.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×