Way back in November 2009 I blogged about improving my email workflows in an entry entitled “Getting to Grips with eMail“, and while I made some significant improvements, there were a few large holes that I just couldn’t come to terms with addressing.
Well, to say I have had a bit of spare time recently is an understatement, but it isn’t all negative, as it has given me the opportunity to revisit these area’s. If you haven’t read the first article there were three that in my opinion needed looking at.
- I was still using a hierarchical filling system.
- I hadn’t come up with an effective way to archive my emails.
- I wanted the ability to create To-Do reminders automatically for action items.
In order to address my legacy hierarchical filling system I knew I needed to clear the decks. My email all lives on an IMAP server at my hosting company, but I was starting to get close to my storage limits, not surprising given there was about 10 years email on there. Now to go through that and to try and do something with it just wasn’t going to happen. What I needed to do was archive the email in such a way that I could still find and access all the information quickly and efficiently.
Enter DevonThink Pro Office from DEVONTechnologies. I have been using DevonThink Pro Office for a long time as a Digital Filing Cabinet, and also blogged about that in my Digital Filing Cabinet Series (Part 1, Part 2, Part 3), and knew that the answer lay their, but taking the plunge was a big step. So I backed up my Mailboxes using the mail.app’s built in Archive facility (From within mail.app select “Mailbox” from the menu, and “Archive Mailbox”), and using MailSteward for good measure, then set about importing my email into DevonThink Pro Office. I left it overnight and when I checked in the morning it was done!
Now I needed some convincing that this was going to work for me so set about testing. I had a previously pulled some terms from different emails, that covered searching for an email from someone specific, based on a subject of an email, and based on the content of an email, and all of these were found instantly. Checking within DevonThink Pro Office the folder structure was exactly the same as it had been within mail.app and I spent sometime hunting around, and was kind of disappointed that it all seemed to be there. I know, i’m strange, but I guess I was kind of expecting something not to work. I had my two backups so it was crunch time, and I set about deleting all of the existing folders within my IMAP account. This took a while, and sitting there looking (through my fingers) at a slowly disappearing Mailbox was kind of scary.
Once my IMAP account was clear I setup a flat folder structure with five folders (Finance, Newsletters, Personal, Reports, & Web Sites). Now in practice I could use a single folder, but this way I can setup rules a little easier when I get to scheduling archiving.
I then downloaded and installed MailTags from indev. The idea being that moving forward I will tag my emails to make them easier to search for, and as these are also supported by DevonThink Pro Office allow me to work consistently between the applications. MailTags also allows me to add notes, reminders, etc to the email, allowing me to mark items for follow up in a much more efficient way. Using a combination of MailTags and Mail ActOn I can also automatically set the tag’s etc, automating most of the leg work.
The only hole left therefore was the ability to create To-Do’s for action items that do not stay within email. If you remember the previous article I discussed a category of email I called “Reports / Files”. These are emails that I get through with attachments, and the attachments are generally reports I have requested, such as Google Analytics or a list of broken links on my web site. These reports are attached as PDF’a or Excel documents, and they are what I actually need to review and deal with not the email.
So in “Getting to Grips with eMail” I showed you an AppleScript that saved the file to my downloads folder and deleted the email. Then how I used Hazel to rename and move the file to my DropBox. This was fine up to a point, but with these types of email being processed in the background I found myself forgetting to check them. The answer seemed to be quite simple, modify the script so that it also created a To-Do item. However, I didn’t want to create a To-Do items for every file / report that was saved to DropBox. My web site backup’s for example are sent to me in as .gz files. I don’t need to do anything with them, just keep a copy of them. So I would need two scripts, one to save the attachments and one to create the To-Do item. AppleScript Editor here I come.
using terms from application "Mail"
on perform mail action with messages theMessages
tell application "Mail"
repeat with eachMessage in theMessages
set theSubject to subject of eachMessage
set theContent to content of eachMessage
try
tell application "iCal"
set newtodo to (make new todo at end of todos of calendar "Mail To Do")
tell newtodo
set priority to medium priority
set summary to theSubject
set description to theContent
end tell
end tell
end try
end repeat
end tell
end perform mail action with messages
end using terms from
It was only when it came to testing I realised that mail.app’s rules will only allow you to run a single AppleScript. So I would need three scripts. One to save the attachments, one to create To-Do items, and one to do both!
using terms from application "Mail"
on perform mail action with messages theMessages
set theAttachmentPath to "Macintosh HD:Users:Mark:Downloads:"
tell application "Mail"
repeat with eachMessage in theMessages
set theSubject to subject of eachMessage
set theContent to content of eachMessage
try
tell application "iCal"
set newtodo to (make new todo at end of todos of calendar "Mail To Do")
tell newtodo
set priority to medium priority
set summary to theSubject
set description to theContent
end tell
end tell
end try
set Attached to mail attachments of eachMessage
repeat with ThisAttach in Attached
set FileName to name of ThisAttach
save ThisAttach in theAttachmentPath & (FileName)
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from
using terms from application "Mail"
on run
tell application "Mail" to set sel to selection
tell me to perform mail action with messages (sel)
end run
end using terms from
With this done I confirmed it was working but stumbled on another issue. As we all know Apple’s implementation of To-Do’s and there ability to play nicely with other applications is, lets say, somewhat lacking. If you simply want a To-Do created this will do the job (the script up to this point create’s a To-Do item in the Mail To Do items folder within iCal and mail.app), but I use OmniFocus from the OmniGroup to handle my To-Do items. So I spent a good couple of hours playing around with AppleScript Editor and drinking copious amounts of coffee, and then it dawned on me, OmniFocus already allows me to email To-Do’s to myself, so all I needed to do was amend the rule to forward the email to my OmniFocus email address, which is automatically picked up and added to OmniFocus inbox.















