Contact Us

TextExpander & Apple Mail recipient name auto insertion

Posted on 3/9/08 by Felix Geisendörfer

Hey folks,

this is post #15 of my 30 day challenge.

Today I want to share a little Mac productivity trick for Apple Mail that I came up with yesterday. I'm in the process of switching from my long-time E-Mail client Thunderbird. Thunderbird and I had a good time, but I can't deal with its problems anymore. UTF-8 emails break text selection, line breaks are off, and a few other things here and there annoy me. But most importantly, Thunderbird does not do a good job on osx integration.

So one of the things I was used from Thunderbird was an extension called QuickText. It basically allowed me to define a response template where I could use the recipients first / last name as a placeholder variable. After doing some research in the Apple Mail world, I found that MailTemplate seems to do what I needed. However, I wasn't too happy to have to do 2 mouse clicks for invoking it.

Meet TextExpander. TextExpander is basically a tool that can auto-insert custom snippets wherever you need them. There are tons of tools like this out there, but most Mac folks seems to like this particular implementation.

Anyway, the big problem with it is, is that it has no direct Apple Mail integration. Therefor you cannot use the first / last name of the recipient in your templates. However, it does support AppleScript, so after a little tinkering I was able to come up with this:

tell application "Mail"
	set selected to selection
	set msg to item 1 of selected
	set sentBy to (sender of msg)
	"Hey " & word 1 of sentBy & ",\n\n\n"
end tell

My abbreviation for this snippet is "hey". This is a huge help for me since I have to answer tons of different people every day and addressing them with their first name is usually a nice thing to do. I also have some snippets using the last name (mainly for Germans who are all Mr. and Mrs. with each other ^^) , all you have to change is "word 1 of sentBy" to "word 2 of sentBy".

-- Felix Geisendörfer aka the_undefined


You can skip to the end and add a comment.

Patrick said on Sep 03, 2008:

Thank you very much for this awesome tip! I heavily rely on TextExpander but haven't thought of something as handy as this.


This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.