• 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: Brett <email@hidden>
  • Date: Fri, 10 Jun 2005 20:53:05 -0400

FWIW, Mail (in 10.4) keeps messages in ~/Library/Mail/Mailboxes/ mailbox/messageID.emlx

If you know the message's mailbox then you can access it directly that way.


On Jun 2, 2005, at 2:37 AM, Jeff Porten wrote:

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 (Applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden


_______________________________________________ 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
References: 
 >Re: Mail: Finding messages by ID (From: Jeff Porten <email@hidden>)

  • Prev by Date: Of files, lnks and existence
  • Next by Date: iCal scripting help
  • Previous by thread: Re: Mail: Finding messages by ID
  • Next by thread: Adding To A List
  • Index(es):
    • Date
    • Thread