Jump to content

Help readin emails using Outlook


Recommended Posts

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)
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 1 month later...

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
Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...