#4 accepted
Mike Dacre

Applescript and Folders

Reported by Mike Dacre | September 10th, 2010 @ 06:00 PM

First off, I love the idea.

Two big issues for me:

  1. Applescript. I couldn't find any useful automation ability with applescript. Is there any chance this might be added?

  2. Gmail labels/folders. It is not that intuitive to use the Gmail labels - it would be nice to pick which to display in the main sidebar.

Overall, really nice. Mail had been annoying me recently and Thunderbird is too big. Applescript is a must for me though, that is the only reason I ever use Mail any more.



Comments and changes to this ticket

  • benny

    benny September 11th, 2010 @ 11:26 AM

    1. Currently, Applescript support is not a high priority. You may be
      able to increase its priority if you write a bit about what you need to
      do via Applescript.

    2. Could you be more specific as to what is 'not that intuitive'? There
      is no special support for Gmail in MailMate, other than that it tries to
      handle the quirks of Gmail as well as it can, and allows you to
      unsubscribe from mailboxes which would otherwise cause duplicate
      messages. If you have not done so already then you should read the blog
      post about Gmail

    Thanks for the feedback!

  • Thomas Hanke

    Thomas Hanke December 11th, 2010 @ 06:18 PM


    just my two cents:


    Gmail labels/folders. It is not that intuitive to use the Gmail labels - it would be nice to pick which to display in the main sidebar.

    I read it as referring to something like Thunderbird 3's favorite folder view.

    Still, this can be constructed by using the right smart folders.

  • Alexander Kucera

    Alexander Kucera March 28th, 2011 @ 08:54 PM

    • Tag changed from applescript, folders, gmail to applescript, folders, gmail, omnifocus

    I'd like to add a vote for AppleScript support, if I may. I personally am a heavy user of OmniFocus and with Mail.app my workflow involved processing mails in my inbox, deleting it, archiving it and adding anything that needs more work to OmniFocus as a todo (longer replies, waiting for something else before replying, etc.).

    OmniFocus provides a nifty clippings shortcut for that, which does the following:
    Assigns the subject of the selected message as the title of the inbox item. Includes a link to the sender of the message, a link to the original message, and the flagged state.

    Of course, MailMate is missing such functionality at the moment, which involves me doing the above by hand. Tedious. But with AppleScript support, I could write my own script that I could call via shortcut to take care of that often repeated task for me.

    Makes sense?

  • benny

    benny March 29th, 2011 @ 08:48 AM

    Yes, it makes sense and I'll remember the use case when implementing
    scripting support.

  • Alexander Kucera

    Alexander Kucera March 31st, 2011 @ 08:58 PM

    I just remembered another use case.

    I use an application called GrandTotal (http://www.grandtotal.biz/GrandTotal/) for my invoicing and it allows me to create my invoices as PDF, attach them to an e-mail to my customers. Unfortunately, it uses AppleScript for the e-mail part and therefor always opens Mail.app at the moment, even though MailMate is set as standard mail client.

    Not mission critical, I still am able to send my PDF invoices, but definitely up there in the "this is annoying" ranks.

  • Alexander Kucera

    Alexander Kucera March 31st, 2011 @ 08:58 PM

    • Tag changed from applescript, folders, gmail, omnifocus to applescript, folders, gmail, grandtotal, omnifocus
  • Thibaud

    Thibaud April 28th, 2011 @ 12:28 PM

    • Tag changed from applescript, folders, gmail, omnifocus to applescript, devonthink, folders, gmail, grandtotal, omnifocus

    I would also appreciate a support of AppleScript by MailMate. It is needed to be used with DevonThink, an information management software designed for power-users too.

    cf. http://www.devon-technologies.com/scripts/userforum/viewtopic.php?f...

    Do you think a way could be found in the future to use DevonThink with Mailmate?

  • benny

    benny April 28th, 2011 @ 12:36 PM

    I have added DevonThink to my list of applications which need
    AppleScript to integrate with MailMate.

  • emory

    emory October 5th, 2011 @ 06:51 PM

    I'm an OmniFocus and DEVONthink user myself.

    Are there any expectations you would like to set for supporting AppleScript?

    It's the only thing keeping me off MailMate at this point.

  • benny

    benny October 6th, 2011 @ 11:46 AM

    Only that I do plan to make MailMate better at integrating with other applications. Recent steps are

    • the support for the message:, mid:, and cid: URLs
    • the “Copy as Link” menu item
    • the experimental RESTful interface to MailMate which is described in the release notes (don't rely on the output formats yet)

    More work is needed of course, but the main point is that you can expect scriptability, but you should not expect a lot of AppleScript support.

  • Alexander Kucera

    Alexander Kucera February 13th, 2012 @ 03:03 PM

    Hi Benny,

    I just stumbled over a post over at the OmniFocus forums. It is discussing the API and has a short code example for a "send to OmniFocus" command from the developers. Not exactly AppleScript, but maybe something to integrate OmniFocus in a clean and fast way.


  • benny

    benny February 13th, 2012 @ 03:58 PM

    • State changed from “new” to “accepted”

    That forum thread is about iOS, but a quick search revealed that it should work on Mac OS X as well. I am currently working on implementing commands in MailMate, so I've asked for a test license to try out the URL scheme. Otherwise I am sure you'll be able to test it for me ;-)

    Anyone following this ticket and interested in testing commands could/should write me a quick note.

    Commands are essentially going to allow you to run any kind of script on selected messages providing the script with (optionally) the raw message, normalized body text, specific header values, etc.

  • Alex K

    Alex K March 4th, 2012 @ 07:24 PM

    Hi there Benny,

    I am also using Omnifocus and would like to help out testing commands.

  • drking

    drking March 24th, 2012 @ 11:49 PM

    Benny, I heavily use Omnifocus and would like to test commands as well if no problem.


  • benny

    benny March 25th, 2012 @ 01:32 PM

    @Alex K and @drking: I'll make sure to notify you. After releasing 1.4.1 I should have time to get back to both OmniFocus integration and scriptability/integration in general.

  • Alex K

    Alex K March 25th, 2012 @ 06:26 PM

    That's great news Benny. Thanks!

  • Cary Black

    Cary Black April 18th, 2012 @ 01:21 AM

    OmniFocus support is the one thing keeping me from purchasing this app. I absolutely love it, it’s agility, ease of use and keybindings, but OF is indispensable in my daily workflow. I’m excited to hear that it’s being considered.

  • Krzysztof

    Krzysztof September 5th, 2012 @ 11:58 AM

    Love your Client. I will buy it as soon as my Trail ends.

    Scripts (Omnifocus/Devonthink integration) would be awesome!

  • benny

    benny September 5th, 2012 @ 01:39 PM

    @Krzysztof: Thanks for your support. I think it would be awesome too, but patience is still required. You may be able to do some of what you want using “Edit ▸ Copy as Link” and perhaps the extended mailto: URL scheme (to create messages with attachments). The latter is only documented in the release notes of the latest test version of MailMate (current test version should be stable and can be fetched by holding down ⌥ when clicking “Check Now” in the Software Update preferences pane).

  • Tai-Chung Huang

    Tai-Chung Huang September 16th, 2012 @ 05:41 AM

    Here is another petition for DEVONthink script support:)

  • Tai-Chung Huang

    Tai-Chung Huang September 23rd, 2012 @ 03:12 AM

    Another supporter for Omnifocus. Thanks!

  • macula

    macula January 2nd, 2013 @ 08:06 PM

    Yes! I've been testing MailMate for a few weeks and would be devastated to give it up as I am hooked on it. But without OmniFocus integration, I'm afraid I might have to :-(

  • macmath

    macmath January 3rd, 2013 @ 06:45 PM

    OmniFocus and MailMate.

    Hello Everyone. I have been a devotee of MailMate since September 2010 and a devotee of OmniFocus since March 2010. When moving to MailMate I too missed the capability to create actions from emails. However, there is now a nice work-around provided by the OmniGroup for those who use email clients other than Mail.app and who use their sync server. Here is a link describing it.


    Essentially it works like this. You sign up for the service and you get a special email address that goes with your OmniFocus SyncServer account. When you get an email you forward it to the special address (I start typing Send to...and it completes). The next time that OmniFocus syncs to the SyncServer, there is an action in your Inbox whose title is the subject, and with an attachment which is the full content of the email (with the original attachments too). What is missing: You can't automatically go back to the original email within MailMate. However, you do have the entire contents of the email, with attachments, within the action itself so most of the time that would not be necessary.

  • benny

    benny January 3rd, 2013 @ 07:01 PM

    Just for the record, the information needed to go back to MailMate is part of the message headers:

    Message-ID: <42ea86471e935b56bcddb76b8627ac2673ad675d_24@freron.lighthouseapp>

    This can be used to create a link like this (this is what “Edit ▸ Copy as Link” does):


    And this can be opened using open location from AppleScript or simply a open 'message://...' shell command. In other words, a script could probably be made for OmniFocus which automated this process.

    Don't worry, I'm still going to improve the scriptability of MailMate.

  • macmath

    macmath January 3rd, 2013 @ 07:07 PM

    I would also be happy to test any commands, although the above works fine for me. Who knows? It might work better and other functionality might result that I don't know that I need. :-)

  • Mike K

    Mike K March 20th, 2013 @ 10:53 PM

    • Tag changed from applescript, devonthink, folders, gmail, grandtotal, omnifocus to applescript, folders


  • benny

    benny August 28th, 2013 @ 08:55 PM

    Hi everybody. 11 people follow this ticket which I believe makes it the top item in the ticket system. Sorry about the delay, but I'm finally making some progress with respect to more scripting possibilities in MailMate.

    I've got some experimental stuff for those of you willing to try it out. Here is what you need to do:

    1. Download the attached archive and unarchive it.
    2. Move the OmniFocus.mmBundle to ~/Library/Application Support/MailMate/Bundles/.
    3. Download the latest test version of MailMate: Hold down ⌥ when clicking “Check Now” in the Software Update preferences pane.
    4. Do the following in the Terminal:

      defaults write com.freron.MailMate MmTwoPointOhFeaturesEnabled -bool YES

    5. Relaunch MailMate.

    You should now have a Command menu with a single “Add...” action in the OmniFocus bundle. Select a message and try it out (the shortcut is ⌃⇧A).

    Things to note:

    1. Note that the mailbox editor now has a Rules pane. Using this pane, it's possible to setup a rule with a “Run Script” action. In other words, it is possible to automatically create OmniFocus items based on incoming emails.
    2. I'm interested in any ideas for improving/extending the OmniFocus bundle.
    3. I'm willing to make (or help you make) similar functionality for other applications.
    4. I would prefer if any discussion of bundles can be moved to the mailing list or private email.

    Everything is undocumented. I'm interested in use cases and I'll (slowly) document (and improve) the various possibilities of using commands. The OmniFocus example just scratches the surface.

  • Steve Mayer

    Steve Mayer August 29th, 2013 @ 04:45 PM


    Could you provide a sample of how one would add the message body as part of what is added to OmniFocus?



  • benny

    benny August 31st, 2013 @ 10:25 AM

    @Steve: I'll look into this when I have some more time (I'm also making some other improvements to the example bundle).

  • Steve Mayer
  • benny

    benny September 2nd, 2013 @ 09:39 AM

    @Steve: Sorry about the delay. I've attached a new bundle. It has two commands, “Add” and “Add With Summary”. The latter adds the “canonical” text of the message in the note as well as a couple of headers (From and Subject).

    Canonical text is the same that MailMate uses when creating a reply. This also means that selecting text limits the summary to that part. Note that the current version of MailMate fails to handle canonical text for multipart messages (which are most messages), but this is fixed in the next update.

    The commands now use AppleScript instead of a omnifocus: URL to create the task. This has several advantages including keeping the focus in MailMate after adding the task to OmniFocus. Unfortunately it was very tricky to make it work well for non-ASCII characters (UTF-8), but I believe I have found a robust approach.

  • Steve Mayer

    Steve Mayer September 2nd, 2013 @ 02:46 PM


    This works very well! Thanks for taking the time to produce it.

    How hard would it to carry over the Flagged value so that if the message is flagged, the task within Omnifocus is also flagged?

    Thanks again!


  • benny

    benny September 2nd, 2013 @ 02:55 PM

    @Steve: Not so hard I think. The task creation in the AppleScript for OmniFocus should include flagged:true if the virtual header #flags in MailMate contains \Flagged. I'll look into it if I have some extra time. I wonder if it should be the default behavior...

  • Steve Mayer

    Steve Mayer September 2nd, 2013 @ 03:25 PM

    As always Benny, thanks!

  • emory

    emory September 25th, 2013 @ 04:26 PM

    While you're in there I think if you were to either render and respect HTML from a Summary, convert to markdown (!!!!) or strip the tags entirely that would be better than the current behavior.

    If I summarize an HTML email for OmniFocus' task I get plain text dump including the markup.

  • drking

    drking October 15th, 2013 @ 11:11 PM

    Thanks Benny!

  • Paul DeCarli

    Paul DeCarli November 8th, 2013 @ 08:00 PM

    Thanks for your work on this feature!

  • Christian

    Christian December 30th, 2013 @ 06:09 PM

    Another area where MailMate doesn't work nicely with Devonthink is with drag and drop and the Devonthink 'sorter' app in particular. It's not possible to drag and drop an email in MailMate to the sorter app (as is possible in Apple Mail) nor directly to Devonthink.

    Standard behaviour would be that the file is copied to the new app (it shows the (+) sign but nothing is copied). I suppose this has to do with how MailMate handles files that are dragged and dropped in general rather than custom integration with a specific app so would be nice to see this fixed as well. I assume it would make it work more nicely with other apps too and not only Devonthink.


  • benny

    benny December 30th, 2013 @ 10:44 PM

    @Christian: Dragging to the Finder works which is essentially the same thing, but you are probably right that I should somehow be able to make it work with Devonthink. I wouldn't be surprised though if it then fails to work with some other application…

    In general for anyone reading this ticket: The most recent versions of MailMate have some built-in experimental bundles for various applications. Enable 2.0 features in the General preferences pane, restart MailMate, and then look for the Command menu.

  • Christian

    Christian January 2nd, 2014 @ 08:50 AM

    Thanks for the response @benny.

    I noticed something else in relation to this. Dragging and dropping any attachments works perfectly but not the actual email. I guess there's a difference in how attachment vs email files are referenced in MailMate.

    You are right however that there are several other apps that can't handle drag and drop and the DevonThink sorter app thus fails with them too.

    There is a rather cumbersome workaround to this though... reveal the email in finder and drop that file into DevonThink.

  • Jeffrey Horn

    Jeffrey Horn January 7th, 2014 @ 01:57 AM

    @Christian, have you tried using the Global Inbox in the Finder Save dialog? This might only be a feature of the Pro versions. Also, if you've made "hot folders" with DevonThink, you could drag emails to that folder and they'll be imported the next time DevonThink is opened.

  • Christian

    Christian February 28th, 2014 @ 03:05 PM

    That's a great workaround Jeffrey! Works fine dropping the emails directly into the Global Inbox. Will try to setup a hot folder to get them directly to the relevant location in Devonthink.

    Thanks a lot for the tip!

  • benny

    benny February 28th, 2014 @ 03:43 PM

    @Christian: If I remember correctly I've actually fixed a bug related to drag'n'drop of emails. It might work in the latest beta (see the Software Update preferences pane).

  • Des Dougan

    Des Dougan June 3rd, 2014 @ 06:48 PM

    Rather than creating a new thread, I'll add my comment here. I have a rule in Mail.app that calls an AppleScript on receipt of an email from my mailbox. They email me when a package has been delivered for me; the AppleScript sends me a text message as I'm not often at my desk.

    Is there a way to do this with the current rules implementation?



  • Des Dougan

    Des Dougan October 27th, 2018 @ 08:08 PM


    Are you any further forward adding AppleScript support to the Rules engine? The bundled apps (BBEdit, etc. are fine as far as it goes), but being able to run an AppleScript in the Rules engine would be fantastic.



  • benny

    benny November 21st, 2018 @ 11:20 AM

    @Des: Rules can execute bundle commands and bundle commands can be any kind of scripting language including AppleScript. I would say it's very likely possible to do what you want.

  • Mike K
  • Keith Martin

    Keith Martin May 20th, 2019 @ 02:53 PM

    I'd like to be able to have Mailmate launch something in response to a rule being matched. Passing parameters – sender, subject, etc. – would be great, but at its simplest I would like to be able to run a nominated app or an AppleScript in response to (for example) a specific email account sending me something.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Mac OS X email client.

Shared Ticket Bins


Referenced by