Unable to Read mails from Entourage IMAP account

C

coolanil.saini

Hi,

I wanted to read mails on the basis of subject, but stuck on the
error can't get every message of IMAP account <account name>. I got
the error on "repeat with k in messages of folder named InboxFolder of
IMAP account IMAPAccountName" this line.. I am using Entourage 2008.

Script as follows:

global IMAPAccountName
global passMsg

set IMAPAccountName to "Anil"
set passMsg to "No unread message"

tell application "Microsoft Entourage"
activate
set IMAPaccounts to {} as list
set m to 1 as number
repeat with i in IMAP accounts
set IMAPaccounts to (IMAPaccounts & name of i)
if (item m of IMAPaccounts) = IMAPAccountName then
set n to 1 as number
set mailFolders to {} as list
repeat with j in folders of IMAP account IMAPAccountName
set mailFolders to (mailFolders & name of j)
if (item n of mailFolders) = "INBOX" then
--display dialog (item n of mailFolders)
set InboxFolder to (item n of mailFolders)
--display dialog InboxFolder
repeat with k in messages of folder named InboxFolder of IMAP
account IMAPAccountName
set messageName to (subject of k) as string
--display dialog messageName
set readStatus to (read status of k) as string
--display dialog readStatus
try
--display dialog messageName & " " & readStatus
if (messageName = "Event accepted: Simple" and readStatus =
"untouched") then
open k
set passMsg to "Email related to the meeting is successfully
read on Mail application"
--return j
end if

on error errmsg
return "Fail. Could not read email. Error: " & errmsg
end try
end repeat
exit repeat
end if
set n to (n + 1)
end repeat
--end tell
exit repeat
end if
set m to (m + 1)
end repeat
end tell

(* close the mail window *)
tell application "System Events"
tell process "Microsoft Entourage"
try

if (name of window 1 = "Event accepted: Simple") then
repeat while (name of window 1 = "Event accepted: Simple")
tell window 1 -- At this stage window 1 is window of the
email.
--click button 1
keystroke "w" using command down
--return name of window 1
end tell
end repeat
return "Pass. " & passMsg
end if

on error errmsg
return "Fail. " & errmsg
end try
end tell
end tell


Please, help me to sort out the problem.

regards,
anil
 
W

William Smith [MVP]

Hi,

I wanted to read mails on the basis of subject, but stuck on the
error can't get every message of IMAP account <account name>. I got
the error on "repeat with k in messages of folder named InboxFolder of
IMAP account IMAPAccountName" this line.. I am using Entourage 2008.

Hi anil!

I'm not sure what you're trying to accomplish but if you simply want a
reference to every message of an IMAP account you can use:

tell application "Microsoft Entourage"
every message of every folder of IMAP account "TalkingMoose"
end tell

If this isn't what you're needing then reply back with the goal you're
trying to accomplish with your script.

Hope this helps!

--

bill

Entourage Help Page <http://entourage.mvps.org/>
Entourage Help Blog <http://blog.entourage.mvps.org/>
YouTalk <http://nine.pairlist.net/mailman/listinfo/youtalk>
Twitter: follow <http://twitter.com/meck>
 
C

coolanil.saini

Hi anil!

I'm not sure what you're trying to accomplish but if you simply want a
reference to every message of an IMAP account you can use:

tell application "Microsoft Entourage"
        every message of every folder of IMAP account "TalkingMoose"
end tell

If this isn't what you're needing then reply back with the goal you're
trying to accomplish with your script.

Hope this helps!

--

bill

Entourage Help Page <http://entourage.mvps.org/>
Entourage Help Blog <http://blog.entourage.mvps.org/>
YouTalk <http://nine.pairlist.net/mailman/listinfo/youtalk>
Twitter: follow <http://twitter.com/meck>

hi bill,

It gives me every message of every folder of IMAP account. But I
want to a read message on the basis of subject which is from the inbox
folder of IMAP account.

instead of
every message of every folder of IMAP account "abc"
message of inbox folder of IMAP account "abc"
 
C

coolanil.saini

Hi anil!

Wouldn't sorting messages by Subject be easier?

--

bill

Entourage Help Page <http://entourage.mvps.org/>
Entourage Help Blog <http://blog.entourage.mvps.org/>
YouTalk <http://nine.pairlist.net/mailman/listinfo/youtalk>
Twitter: follow <http://twitter.com/meck>

hi bill,

thanks for reply, i did it as...

tell application "Microsoft Entourage"
activate
set MessageCounter to 0 as number
repeat with i in every folder of IMAP account IMAPAccountName
if (name of i) = "INBOX" then
--return name of i
repeat with j in every message of i
set readStatus to (read status of j) as string
set messageSubject to (subject of j) as string
--return messageSubject
try
if (messageSubject = subject_csv and readStatus = "untouched")
then
open j
set passMsg to "Email related to the meeting is successfully
read on Mail application"
set MessageCounter to (MessageCounter + 1)
end if
on error errmsg
return "Fail: Could not read mail " & errmsg
end try

end repeat
end if
end repeat
end tell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top