Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8264677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:32:32+00:00 2026-06-08T04:32:32+00:00

I looked and looked but couldn’t find an answer to this seemingly simple question

  • 0

I looked and looked but couldn’t find an answer to this seemingly simple question (I’m also new to AppleScript). Basically, I just want a script that sets up a Rule and moves messages to mailbox “Foo” (a Mailbox in my IMAP account). Here’s what I have:

tell application "Mail"
set newRule to make new rule at end of rules with properties {name:"Foo Internal",   enabled:true}
tell newRule
    make new rule condition at end of rule conditions with properties {rule type:any recipient, expression:"internal_foo@foo.com", qualifier:does contain value}
    set move message to mailbox "Foo"
end tell
end tell

I’ve tried various combinations of this line…

set move message to mailbox "Foo"

…including specifying the IMAP account, setting it to a variable, and so on. I’m not a programmer but I really want to script these rules cause I setup rules all the time at my job. Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:32:34+00:00Added an answer on June 8, 2026 at 4:32 am

    Your script fails because of two things:

    1. it omits to set the should move message property of the rule to true, which is needed for a move message action to actually “stick”;
    2. it does not define the object hierarchy of the target mailbox correctly: you will need both the account and the application context, as you are inside a tell block targeting the rule, not Mail.

    The following code:

    tell application "Mail"
        set newRule to make new rule at end of rules with properties {name:"Foo Internal", enabled:true, should move message:true}
        tell newRule
            make new rule condition at end of rule conditions with properties {rule type:any recipient, expression:"internal_foo@foo.com", qualifier:does contain value}
            set move message to (mailbox "Foo" of account "Bar" of application "Mail")
        end tell
    end tell
    

    will work in Mail 5.2 (stock as of OS X 10.7.4).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This looked like a very simple question but I couldn't find the answer. How
I looked for a specific answer to this question, but couldn't find it --
MySQL noob here; looked around first but couldn't find the answer to this question.
I've looked around for an answer to this one but couldn't find one. I
I looked up my question on the Internet but couldn't find an answer...so I'm
I've looked around here for similar question but couldn't find any that solved my
I have looked at the different questions regarding this issue, but couldn't find anything
I looked around and couldn't find it! Maybe I didn't look hard enough,but this
I looked around on Google for this, but couldn't find anything. I want to
I've looked everywhere for this online, but couldn't completely find it. (my PHP and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.