• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Re: Selecting mail message by ID
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Selecting mail message by ID


  • Subject: Re: Re: Selecting mail message by ID
  • From: "John M, John" <email@hidden>
  • Date: Thu, 14 Apr 2005 23:51:20 +0100

A slightly better script than I posted earlier. This iterates through all the accounts and general local mailboxes and is a lot faster.

--
--get dummy for message ID
tell application "Mail"
	--dummy for message ID
	set theseMessages to selection
	set the messageID to the message id of item 1 of theseMessages
end tell

--call handler from outside mail.app
set myMessage to searchMail(messageID)
tell application "Mail" to open myMessage

-- handler to search Mail.app files for message with message ID on searchMail(messageID)
tell application "Mail"
repeat with a in accounts
repeat with mb in mailboxes of a
set x to (every message of mb whose message id is messageID)
if length of x is greater than 0 then return (item 1 of x)
end repeat
end repeat
repeat with mb in mailboxes
set x to (messages of mailboxes whose message id is messageID)
if length of x is greater than 0 then return (item 1 of x)
end repeat
end tell
end searchMail
--


Best wishes

John M

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Selecting mail message by ID
      • From: Malcolm Fitzgerald <email@hidden>
  • Prev by Date: Re: Insert text and paste command
  • Next by Date: Re: Insert text and paste command
  • Previous by thread: Re: Selecting mail message by ID
  • Next by thread: Re: Selecting mail message by ID
  • Index(es):
    • Date
    • Thread