goldfilm

Q: Creating rule for Mail to emulate Mailbox App

I'm using Mailbox for iPhone and I love the "snooze" feature: it allows you to snooze a message in the inbox sending it to a "Later" folder and bringing it back to the inbox later (tomorrow, this weekend, next week, etc., you choose).

 

I'd love to do the same in Apple Mail with flags. If I mark a message with a red flag, I want it to be moved to a "Later" folder, and I want it back to the Inbox 24 hours later. If I do it with green flag, 2 days later, purple 3, etc...

 

The problem is that Mail rules don't include the flag option as a condition; only as an action. Also there's no way to put a rule temporary (i.e. "if the message is in the folder X for 1 day move it to Inbox) Any way to do this?

MacBook Air, OS X Mavericks (10.9)

Posted on Feb 6, 2014 8:38 AM

Close

Q: Creating rule for Mail to emulate Mailbox App

  • All replies
  • Helpful answers

  • by Neville Hillyer,

    Neville Hillyer Neville Hillyer Feb 6, 2014 12:00 PM in response to goldfilm
    Level 4 (1,877 points)
    Mac OS X
    Feb 6, 2014 12:00 PM in response to goldfilm

    A few months ago I developed a 'send later' AppleScript to work with Mail. Let me know if it would be of any use to you.

  • by goldfilm,

    goldfilm goldfilm Feb 7, 2014 7:59 AM in response to Neville Hillyer
    Level 1 (14 points)
    Mac OS X
    Feb 7, 2014 7:59 AM in response to Neville Hillyer

    Thanks so much for your offer, but what I need is very different: an action when a flag is a condition, and flags are not part of conditions in Mail.

     

    I want to manually flag a message in the Inbox and Mail automatically moving the message to a folder after I flag it. If that happens I'm happy, although ideally I want the message back to the Inbox after a period of time.

     

    Does it sound crazy? thanks!

  • by Tony T1,

    Tony T1 Tony T1 Feb 7, 2014 8:32 AM in response to goldfilm
    Level 6 (9,232 points)
    Mac OS X
    Feb 7, 2014 8:32 AM in response to goldfilm

    goldfilm wrote:

     

    Thanks so much for your offer, but what I need is very different: an action when a flag is a condition, and flags are not part of conditions in Mail.

     

    I believe that's because Mail Rules work on incoming mail and flags are set on the local machine. You can send an email with a priority (i.e. high), but not a flag

     

     

    I want to manually flag a message in the Inbox and Mail automatically moving the message to a folder after I flag it. If that happens I'm happy

     

    Applescript can do this, but not automatically, you could set up this rule, then manually Apply Rules (⌥⌘L)

     

    Rule:

         Screen Shot 2014-02-07 at 11.28.58 AM.png

     

    Applescript:

     

    tell application "Mail"

              repeat with theMessage in (every message of inbox)

                        if flagged status of theMessage is true then

                                  set mailbox of theMessage to (mailbox "Main")

                        end if

              end repeat

    end tell

     

    The Applescript MUST be placed in: ~/Library/Application Scripts/com.apple.mail/

     

     

    ....although ideally I want the message back to the Inbox after a period of time.

     

    Not sure if that can be done.  Maybe with  launchd and osascript

  • by goldfilm,

    goldfilm goldfilm Feb 15, 2014 8:56 AM in response to Tony T1
    Level 1 (14 points)
    Mac OS X
    Feb 15, 2014 8:56 AM in response to Tony T1

    Hello there,

     

    thanks so much but I can't make it work. This is the script I have. I adapted yours a little bit because I have many inboxes, and that's what I may be doing wrong:

     

    tell application "Mail"

              repeat with theMessage in (every message) of (mailbox "INBOX" of account "Gmail")

                        if flagged status of theMessage is true then

                                  set theMessage to (mailbox whose name is Later) of account "Gmail"

                        end if

              end repeat

    end tell

  • by Tony T1,

    Tony T1 Tony T1 Feb 15, 2014 9:15 AM in response to goldfilm
    Level 6 (9,232 points)
    Mac OS X
    Feb 15, 2014 9:15 AM in response to goldfilm

    See if this works (I tested with set Later to "Junk", and it worked):

     

    tell application "Mail"

              repeat with theMessage in (every message) of (mailbox "INBOX" of account "Gmail")

                        if flagged status of theMessage is true then

                                  set theAccount to (account of mailbox of theMessage)

                                  set mailbox of theMessage to (mailbox Later of theAccount)

                        end if

              end repeat

    end tell

  • by goldfilm,

    goldfilm goldfilm Feb 15, 2014 9:52 AM in response to Tony T1
    Level 1 (14 points)
    Mac OS X
    Feb 15, 2014 9:52 AM in response to Tony T1

    Is not doing anything... when you tried it with your Junk what hapenned? You manually flagged a message in the inbox and after applying the rules it moved it to Junk? Thanks!

  • by Tony T1,

    Tony T1 Tony T1 Feb 15, 2014 10:37 AM in response to goldfilm
    Level 6 (9,232 points)
    Mac OS X
    Feb 15, 2014 10:37 AM in response to goldfilm

    Yes, Flagged the email with Screen Shot 2014-02-15 at 1.27.43 PM.png and then ⌥⌘L and the email was moved to Junk

     

    Did you put the Applescript in:

    ~/Library/Application Scripts/com.apple.mail/

    and did you set the rule as:

     

    Screen+Shot+2014-02-07+at+11.28.58+AM.png

     

     

    Note: My Gmail account is POP, not IMAP

  • by goldfilm,

    goldfilm goldfilm Feb 15, 2014 10:38 AM in response to Tony T1
    Level 1 (14 points)
    Mac OS X
    Feb 15, 2014 10:38 AM in response to Tony T1

    Exactly. This is the script:

     

    tell application "Mail"

              repeat with theMessage in (every message) of (mailbox "INBOX" of account "Gmail")

                        if flagged status of theMessage is true then

                                  set theAccount to (account of mailbox of theMessage)

                                  set mailbox of theMessage to (mailbox "Later" of theAccount)

                        end if

              end repeat

    end tell

     

    I compile it, run it, save it to ~/Library/Application Scripts/com.apple.mail/ as "Later"

    and it automatically appears in the lsit of scripts while I'm creating the rule.

  • by Tony T1,

    Tony T1 Tony T1 Feb 15, 2014 10:39 AM in response to goldfilm
    Level 6 (9,232 points)
    Mac OS X
    Feb 15, 2014 10:39 AM in response to goldfilm

    Could be that I get it to work as I tested with my Gmail POP account (not IMAP)

  • by devil-doll,

    devil-doll devil-doll Feb 15, 2014 11:38 AM in response to goldfilm
    Level 1 (0 points)
    Feb 15, 2014 11:38 AM in response to goldfilm

    goldfilm wrote:

     

    Does it sound crazy? thanks!

     

    Not at all, I've been looking for just the same thing.

    An Apple Mail version of what Boomerang does in GMail (via a browser))...

     

    In a word... "snooze" a message.

     

    So did you get this to work?

  • by bahmedov,

    bahmedov bahmedov Jan 20, 2015 11:57 PM in response to goldfilm
    Level 1 (0 points)
    Jan 20, 2015 11:57 PM in response to goldfilm

    What could be done is to create a smart folder which collects all the messages with "Blue" (or any particular) colour. Once you have read (or finished an action over it), you could unplug it, and it goes away from the smart folder.

     

    The idea with the script which considers all the messages in my Inbox is not fits with me, since I have thousands of messages... 

  • by Ben Hopkins1,

    Ben Hopkins1 Ben Hopkins1 Jul 26, 2016 8:24 AM in response to Neville Hillyer
    Level 1 (4 points)
    Jul 26, 2016 8:24 AM in response to Neville Hillyer

    Hi Neville,

    I'd love to have that AppleScript. I just made a big cc error and would love to be able to do "send later" so I can have time to review. And if you wouldn't mind a little coaching on how to install and run, that would be awesome . Thanks!