• 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: Mail: Finding messages by ID
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mail: Finding messages by ID


  • Subject: Re: Mail: Finding messages by ID
  • From: Jeff Porten <email@hidden>
  • Date: Thu, 2 Jun 2005 02:37:59 -0400

On May 26, 2005, at 10:28 PM, kai wrote:

to getMessageRef from messageID
    tell application "Mail" to repeat with m in mailboxes
        tell (m's first message whose message id is messageID) ¬
            to if (count) is 1 then return it
    end repeat
end getMessageRef

set messageID to "<insert message id here>"
set messageRef to getMessageRef from messageID

Whose clauses work great when in conjunction with a strategy of keeping target messages in small mailboxes. I.e., a trigger script that moves/copies a message to a followup folder, with a second script searching that folder.


OTOH, I just managed to give Mail.app the Rainbow Pizza of Death by doing a test whose against a mailbox with 34,000 messages in it.

For some reason, locate is borked on my clean install of Tiger. Otherwise, the above script would work like a charm -- provided your email message was more than 7 days old.

Here's the script to get the file with Spotlight:

set spotlightFile to do shell script "mdfind \"kMDItemFSName == '" & msgId & ".emlx'\" | grep '/" & msgId & "'"

The grep pipe is necessary so a search for msgID 10000 doesn't also return msgID 110000 et al.

Best,
Jeff _______________________________________________
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: Mail: Finding messages by ID
      • From: Brett <email@hidden>
  • Prev by Date: Re: ANN: String to Property Coercion subroutines released
  • Next by Date: Re: EPS to JPEG
  • Previous by thread: Re: ANN: String to Property Coercion subroutines released
  • Next by thread: Re: Mail: Finding messages by ID
  • Index(es):
    • Date
    • Thread