• 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
Mail script to automatically manage mailboxes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mail script to automatically manage mailboxes


  • Subject: Mail script to automatically manage mailboxes
  • From: lost+found <email@hidden>
  • Date: Tue, 31 May 2005 14:43:43 +1000

I want to be able to move messages between mail applications (on different machines), preserving the mailbox hierarchy, as a rudimentary email archiving system. I hope to create a rule that will run on any message older than X days, and automatically move that message to a similar folder on another machine.

I got applescript to talk to the mail app on the remote machine okay, and I can create top-level mailboxes, but I can't work out how to dynamically check and recreate an entire hierarchy of mailboxes. Specifically,

(A) I can't work out how to quickly check if mailbox already exists 
(B) I can't get Mail.app to create a new mailbox within an existing mailbox (although I can create top-level mailboxes).

--- (A) ---
It is easy enough to iterate over all the mailboxes, but this is needlessly inefficient, if Mail will return all the top level mailboxes. The top level mailboxes use a nebulous parent container whose name is: account "On My Mac". For example, the 72nd mailbox is a top level mailbox... and the following is dumped from the event log:

  get name of container of item 72 of every mailbox
        account "On My Mac"

Now, if I get Mail.app to return all of the accounts, I don't get this "On My Mac" account... so how to I quickly get a handle to this account object? Is it impossible? If I can get a handle to this object, I can then to a hierarchical search to find out if a given mailbox exists in the right spot in a tree.

--- (B) ---
I can get Mail to create top-level mail boxes like so:

    set theNewMailbox to make new mailbox with properties {name:"my_new_mailbox"}

Which is great, however, I can't find any way to create a mailbox that is a sub-mailbox of an existing mailbox.

 _______________________________________________
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

  • Prev by Date: Re: Dates in iCal
  • Next by Date: [ANN] Tiger compatible version of Script Timer available
  • Previous by thread: Re: Dates in iCal
  • Next by thread: [ANN] Tiger compatible version of Script Timer available
  • Index(es):
    • Date
    • Thread