I’ve trying to find the answer to this but as yet haven’t succeeded.
In my ‘Inbox’, in Mail, I have several subfolders. Please can someone tell me how I get the count of such a mailbox and how do I refer to a message within that subfolder.
I’ve tried this but the subfolder isn’t being found:-
tell application "Mail"
set target_mailbox to "mailing list"
try
set y to get mailbox target_mailbox
end try
end tell
display dialog (count of y)
tell application "Mail"
activate
set EveryMailboxList to mailboxes
set EveryMessageListInFirstMailbox to messages of item 1 of EveryMailboxList
set TheSubject to subject of message 1 of item 1 of EveryMailboxList
display dialog TheSubject
--Get every Mailbox name
set MialboxNameList to {}
repeat with ThisMailBox in EveryMailboxList
set MialboxNameList to MialboxNameList & (name of ThisMailBox as string)
end repeat
choose from list MialboxNameList
end tell