the candler blog

Apple Mail to Day One Service

Productivity, Technology, Writing

For months I have been using Brett Terpstra’s Slogger to fill up Day One with my collected tweets, blog posts, listening preferences and the like. It wasn’t until last week, though, traveling back to Philadelphia for Thanksgiving, that I started writing entries into the Mac and iOS journaling app. I’m really enjoying dumping my thoughts, my worries, my dreams into Day One. I honestly have no idea whether I’ll want to look back on any of the stuff I siphon into it, but for now I’m happy it’s there.

I’ve been poking around the web the past few days to figure out how to get emails into Day One. It sounds like an odd request (why not just search for emails as needed?), but I’d like to explain why I set out to make this happen.

A Personal Use

My great aunt isn’t doing too well. She’s been in the hospital these past few weeks recovering from complications after surgery. I visited her in the hospital when I was home and we had a great conversation. She’s tough, but in the days since we spoke she took a bit of a turn.

The whole ordeal gives me pause. It makes me think of the conversations she and I haven’t had over the years, the ones I had planned to have “later.” I also think of the many conversations we’ve had that I plumb forgot. And so I’ve been making an effort to recount my time with her in Day One, to at least keep track of how this experience has been for me and my family.

My cousins (my aunt’s daughters) and my mother have been texting and emailing updates as things progress. I’ve gotten enough of these emails now to recognize that there is some lasting value to them. They are little notes along this path; little reminders of what’s going on in my world right now. Those are the kinds of signifiers I’d like culled and collected into Day One.

More Generally, Correspondence

On rare occasions I’ll go looking through old emails for fun, to see what I was thinking way back when or check out who was saying what to me. Since email is ever-searchable, I generally just let it all pile up, ready for retrieval if ever I need a specific message.

I’d like to collect some of my more interesting correspondence. Good news, bad news, intriguing arguments…a lot of this sort of thing still happens in email for me. I can think of more than a few instances of emails from the past decade that I’ve wanted to retrieve, only to find that they’re lost for good.

So I’ll start clipping emails to Day One. Not all of them, of course. Just the ones that seem impactful to me.

How It Works

This service triggers an AppleScript that creates a new Day One entry with the contents of the currently selected email in Apple Mail. The entry’s date will match email’s date stamp and the entry text will look like this:

1
2
3
4
5
6
7
8
9
10
11
## Email Message from {Sender}

[View Original Message](message://path-to-email)

**Subject:** {Subject}
**From:** {Sender} ({sender's email address})
**Date:** {the date}

---

{Email content}

Once the script does its magic you’ll get a Growl notification (if you have it installed) letting you know entry has been created. Day One doesn’t need to be open for this to work, nor will it launch or activate.

Important: The AppleScript requires the Day One Command Line Interface. It’s a very simple installation; go get it.

If you would like to just try the raw AppleScript and trigger it from elsewhere, you can view and download it here.

Installation

  1. Make sure you have the Day One Command Line Interface installed.1
  2. Download Apple Mail to Day One.zip and unzip it.
  3. Move Apple Mail to Day One.workflow to ~/Library/Services/.
  4. Configure a Keyboard Shortcut in System Preferences > Keyboard > Keyboard Shortcuts > Services. I recommend ^⌥⌘D, only because that’s what I’m using.

Notes

  • This service doesn’t actually receive any input before running the AppleScript, however it is restricted to only work in Apple Mail. As such your keyboard shortcut won’t be global; it will only clip the message if Mail is active.
  • No formatting from the body of your message will be retained, so no links or quote levels. I’d like to change this in the future but the only way to get it working through AppleScript seems to be parsing the raw source message, which is a real pain.2
  • I made this for clipping received messages. Running it on a sent message will work, but it will look like it’s “from” you (which it is).
  • Attachments don’t carry over into Day One, but the CLI does make it pretty simple to pass an image to Day One. Maybe in the future I’ll make a different service to get attached pics into Day One.

Big Thanks

This script is a modified version of one by Justin Lancy (aka Veritrope). His original could take mail messages and export them into text documents. His code was damn clean; I barely changed anything but the output.

The structure of the mail message link is based on this 2007 AppleScript by John Gruber. Still works.

Initially I tried to get this working with Brett Terpstra’s Clip To Day One System Service. Once I started working with the Day One CLI, I realized I didn’t need to mangle Brett’s ruby script. (The holdup was getting the Day One entry’s creation date to match the email’s received date.) I’d be remiss if I didn’t mention it.

Tip Me If You Can

If you’d like to throw a little something my way I’d be very appreciative. I maintain the candler blog and these other little projects in my spare time. If you’re able and want to get me a coffee, a beer or dinner, this is the easiest way to do it. I thank you in advance.

  1. Test it in a terminal window to be sure it’s working. The FAQ does a great job explaining how to test it out.

  2. Go select a message in Mail and hit ⌥⌘U to see what I’m talking about.

Comments