Add Last Sent Email To OmniFocus

Most delegation – formal or informal – happens by email today. Whether you ask your spouse if she likes the garden furniture you found online or ask one of your employees to fill an Excel sheet, chances you send a link, attachment or just the request by email are high.

As a diligent GTDer you do not want to remember that your spouse owes you an opinion and your employee an Excel sheet: You want to track this “Waiting For” in your trusted system OmniFocus and not in your head.

Already a couple of years ago I had the honour to address this problem by kicking off some scripting work involving MailTags and Mail-Act-On outbox rules in Mail.app to automatically capture emails tagged as “waiting for” when they leave the outbox and add them to OmniFocus. The great nerd community behind OmniFocus has ever since taken the script to develop it further and to make it more robust.

The problem with the above solution is that you need to have MailTags & Mail-Act-On – which are both great, but also pricey – and you need to remember to tag your delegating email before your send it. I tend to always forget to tag an email and regret it seconds after I pressed ‘Send’.

“Oh man, that last email! I should really track that in OmniFocus!”

If you have time and you want to make the effort, you can certainly go into Maill.app’s Sent mailbox and use the OmniFocus clipping service to add the message to your OmniFocus Inbox. Since I have the Mailbox panel hidden by default (⌘⇧M) and hate navigating around with the mouse too much, I rarely do that. What I do instead more and more is look at my ‘Sent’ mailbox at the end of a day and clip those emails into OmniFocus that I have sent during the day and that I want to track in my ‘Waiting For’ context.

But what I realised over time is that it would be rather beneficial to have the ability to add the last email sent to OmniFocus in a similar way as the MailTags-based solution mentioned earlier. So I cooked up a simple AppleScript to do just that.

The script is rather barebones and I am sure some smart people will take it away and make it much better, robust and sophisticated. Until that day the script works as follows:

  • It looks in one specific Sent mailbox (when I tried having it look at the virtual Sent mailbox that spans all your accounts in Mail.app the results became very inconsistent)
  • It then takes the last message it finds
  • Adds it either directly to your OmniFocus Inbox or pre-populates and opens OmniFocus’ Quick Entry window
  • When adding it straight to the OmniFocus Inbox you can have Growl providing a notification as feedback
  • You can configure a prefix to the task created as well as a mid-fix that goes between recipient name and subject of the original email, e.g. ‘Waiting for [recipient] to comeback re [subject]‘
  • The script also defects if you send the email to one or more recipients (only the ‘To’ field matters). If you sent it to more than one it will take the name of the first one and add ‘and x more’ to the task description

That is pretty much it. Download the script, save it somewhere on your disk and invoke it by adding it to the OmniFocus toolbar, via the Mac OS X AppleScript menu (activate it in the preferences of the AppleScript Editor) or by using handy tools like FastScripts, Alfred, Launchbar or Keyboard Maestro.

  • johnsel

    Nice script.

    I achieve the same thing through BCC. I always have BCC showing on my mail clients. Whenever I am composing an email that is delegating something, I BCC my OmniFocus Mail Drop account. No need for a separate action to get the message into OF. This is particularly good because I’m not always on a Mac on Mail.app – I use Outlook at work on a Windows machine, for instance.

    Admittedly I sometimes forget to do so, and a script like this could be useful.

  • http://rickcolosimo.com Rick Colosimo

    That’s a nice shortcut, too. I just use BCC on pretty much everything (except email forwards to spootnik/OF) and never ever look at my sent messages for processing. This way, anything that might need to be processed shows up exactly where most of my other incoming tasks do: right in my inbox. Fewer buckets is good.

  • Neil Gordon

    Every device that I use has an automatic bcc to myself set up so anything emailed that requires follow up or to add to waiting is added to OF from my in-box as I deal with all email.

  • http://twitter.com/canion Andrew Canion

    This is really great, thank you so much.

  • Lothar

    Sven, I have been searching for such a script for a while. I tried it, it works out of the box. Thank you for sharing this.

  • http://twitter.com/lengcaloh Leng Caloh

    This is exactly what I was looking for. I’ve got it running via an Alfred keyword (how brilliant of you to integrate the Alfred script into it).

    One thing I’d like to be able to add to it, is the “Waiting” context. I’ve never written AppleScript before so I’m not sure how to go about it. Any suggestions?

    Thank you!!

  • http://twitter.com/lengcaloh Leng Caloh

    I figured it out:

    tell quick entry

    open

    set theContext to context named “Waiting”

    make new inbox task with properties {name:theTaskTitle, note:theNote, context:theContext}

    tell application “System Events” to keystroke tab

    activate

    end tell