All-Rules Mail Bundle: The shortcut to your Mail.app rules

Have you ever wanted to automate some message sorting tasks in Apple’s Mail application after you have read a message? I, for example, use one archive folder per account and move all messages into that folder after I’ve read them. The application’s rule system is perfectly suited for that task, unfortunately there is no way to activate certain rules by pressing a keyboard shortcut. That’s where this bundle comes into play.

The All-Rules Mail Bundle acts as a plugin for Apple’s Mail application and serves just one specific purpose. It provides an additional menu item located under “Message -> Apply All Rules” which applies all active rules to the currently selected messages while ignoring any present “Stop evaluating rules” action.

Where to get the bundle

The source of the bundle is available at GitHub as a standard Xcode project. Feel free to adapt it to your needs if necessary. I will also provide a precompiled binary for those of you who just want to use it out of the box.

Note that I’ve developed and tested the thing on my only Mac machine, which clearly is an inadequate test coverage. As always I would be happy about any response. So far the bundle is known to run in the following environment, which is the most recent one at the time of writing.

  • Mac OS X Snow Leopard 10.6.6
  • Mail Application 4.4
  • Message Framework 4.4

How it is implemented

First of all, let me emphasis that this is the first time I actually did some Objective-C coding. But I really liked the feel of it. I was really surprised about the power of the Objective-C runtime. You can do lots of nasty stuff at runtime like changing class hierarchies, adding methods to classes, changing method implementations and so on.

I used one technique known as method swizzling in the bundle, which lets you switch the existing implementation of a method with your own replacement at runtime. This enabled me to override the original shouldStopEvaluatingRules implementation of the MessageRule class inside the Message framework.

Unfortunately most of the APIs of the Mail application and the Message framework are private, so I expect my bundle to break sometime in the future. But the API can be easily reverse engineered with the class-dump utility which generates header files out of Objective-C binaries.

To prevent bundles from silently breaking, each bundle includes a list of the exact versions of Message frameworks and Mail applications it is compatible with. I found an article that explains how to fix unsupported plugins after upgrading Mail.app without recompiling them. So if you have different versions running on your machine that are compatible as well, let me know about them.

And last but not least I want to mention one article which helped me a lot in figuring out all those tiny details and really did it’s job in demystifying Mail.app plugins on Leopard for me.

Related bundles

The same (and more) could be done with Indev’s Mail Act-On bundle, unfortunately that bundle is sold under a commercial license. With my bundle I cloned the essential feature which was indispensable for my personal use.

I was very encouraged to find

I was very encouraged to find this site. The reason being that this is such an informative post. Thanks for sharing!

Nice to know that the author

Nice to know that the author even indicated how this should be implemented

This is really informative,

This is really informative, Thanks a lot!
-Grant

Really agree with you there.

Really agree with you there. Wait, what are you guys talking about again? This comments section is a mess right now.

https://www.desertsunconcrete.com/

I couldn't agree more.

I couldn't agree more. Anyway, if you're looking for someone to repair your sprinklers in Phoenix, you must try this: https://www.sprinklerinstallphoenix.com/sprinkler-repair.html

I found that recent updates

I found that recent updates prevent this mail app from displaying properly. When can we expect an update?

So great! Thanks for the

So great! Thanks for the update.

This was a great update. It

This was a great update. It makes life easier. Thank you for sharing.
https://www.electricianreddingca.com/

Thanks for sharing this

Thanks for sharing this information. It was really a great app.
https://www.carpetcleaning-lancaster.com/

Thank you for sharing! If you

Thank you for sharing! If you are looking for the best cleaning professionals, visit our site!

Thank you for sharing this

Thank you for sharing this amazing post. keep up the great work

Awesome! This is helpful for

Awesome! This is helpful for me.

Awesome, thanks for sharing!

Awesome, thanks for sharing!

The site was so nice, I found

The site was so nice, I found out about a lot of great things. I like the way you make your blog posts. Keep up the good work and may you gain success in the long run.

Thank you for sharing this

Thank you for sharing this amazing post. keep up the great work

cool blog! I found some good

cool blog! I found some good stuff here for future reference. Hope to see more posts in the future!

This is such a great blog.

This is such a great blog. Thank you for sharing your talent with everyone. You are an inspiration.

Thank you for sharing the

Thank you for sharing the article, very helpful and informative . If you're looking for moving services, I highly recommend this website <a href="https://riverside1movers.com">riverside1movers.com</a>

Thanks for pointing this one

Thanks for pointing this one out. Awesome write up.

Impressive explanation. Thank

Impressive explanation. Thank you for educating us.

Santa Ana you are so right!

Santa Ana you are so right! They did an amazing job.

I wouldn't exactly call their

I wouldn't exactly call their work "amazing," but yes - it does the job. What more could anyone ask for, right? http://blitzmarketing.org

I've been contemplating

I've been contemplating buying this after reading this post.
https://www.treeservicegrandrapidspro.com/

Using it a month even though

Using it a month even though I have a newton subscription that I will not be renewing considering they've done no further development. https://www.lansingtreeservicepro.com/

I was directed to your post

I was directed to your post by an SFM member. Big help
https://www.treeservicegreensboropro.com/

This is a great post. I like

This is a great post. I like this topic.

This is what I am looking

This is what I am looking for, the shortcuts to Mail-up rules. Been searching for this in Google and youtube but this one is detailed.

You really emphasized all the

You really emphasized all the details with these rules. I appreciate your efforts. Thanks!

Thanks for sharing

Thanks for sharing

Thank you for explaining

Thank you for explaining these rules of mail bundles. This will help for the awareness of the beginners.

Yes i did not know very much

Yes i did not know very much about mail bundles. Helped me climb that learning curve!

Thanks for sharing.

Thanks for sharing.

This is the thing that I am

This is the thing that I am searching for, the easy routes to Mail-up rules. Been looking for this in Google and youtube yet this one is nitty-gritty.

This is really amusing and

This is really amusing and very helpful, glad that this was shared to the world.

It was helpful, but the info

It was helpful, but the info is outdated now. I think the blog entry needs to be updated.

Doing a big clean-out can

Doing a big clean-out can often mean getting rid of old junk. Unfortunately, this can be a serious hassle. Often the junk that’s piled up in your basement, garage, or around your property, such as old furniture or appliances, is difficult to move, let alone remove or get rid of.

Grateful that you publish

Grateful that you publish this, really lucky to have found this!

Quite useful and interesting,

Quite useful and interesting, hoping for the next update

This post is providing

This post is providing valuable and unique information. Great job, thanks for the insight given.

There are many ways to

There are many ways to approach problems like this on the page.

This is actually a good site

This is actually a good site that contains good contents https://www.napervilleservicelimo.com/

This is a great bundle! A

This is a great bundle! A very useful shortcut. Thank you for sharing!

what bundle are you talking

what bundle are you talking about?

It is indeed! Absolutely

It is indeed! Absolutely agree.

Which points of his message

Which points of his message do you agree with? http://www.laquintaalmightytowing.com

Snow Leopard was perhaps the

Snow Leopard was perhaps the best version of OS X relative to when it was released.

Very interesting post. This

Very interesting post. This is my first time visit here. I found so many interesting stuff in your blog especially its discussion. Thanks for the post!

Thanks for taking the time to

Thanks for taking the time to discuss this.

Boldness in itself is genius.

Boldness in itself is genius.