Updates and Improvements to the Salutation AppleScript for Apple Mail

My relationship with Apple Mail isn’t love so much as familiarity. However, every time I think about walking out on Apple Mail, I think about our long and complicated relationship, and how much work I’ve put into it with things like my salutation AppleScript.

The Updated Script

Using a combination of AppleScript and TextExpander, I’m able to automatically insert an email salutation by typing “xhi”. This is really useful and something I run multiple times a day. The original post and explanation on how it works is still good. However, the script has altered a bit. You can download the updated version, called “xnm” (“X Name” in my head) here. I suggest running it as an embedded TextExpander snippet so you can combine it with a variety salutations like “Hi”, “Hello”, “Dear”, “Hey”, and whatever else floats your boat. Also, you can download the TextExpander group with both the “xnm” and “xhi” snippets here. That should be all you need to get this rolling.

But What About Multiple Recipients?

Reader Mark Bramhill had that exact question and came up with two variations of this script. The first will make a salutation for everyone in the “To:” field. If you regularly (or occasionally) send email to multiple recipients, this variant is for you.

Download Multiple Recipients AppleScript

That, however, wasn’t enough for Mark. He made a separate AppleScript that counts the number of recipients. If there is just one recipient, it inserts that person’s name. If there is more than one (including looking at the cc: field), the script instead writes “Y’all”. I thought both of these scripts were pretty clever.

Download the “Y’all” Script

Language Specificity

I also had several emails from non-english speakers about the script not working. The trouble is in this line:

tell text field "To:" of window 1

As you can see, the script is language-specific. In English, the script looks for the “To:” field, but in other languages, that field has a different name. In Dutch, for instance, it’s “Aan:”. If your native language isn’t English, you’ll need to fix that line appropriately.

I do love how this script has taken on a life of its own. This isn’t a testament to anything particularly bright on my part but the utility of a script that auto-salutes every email you send. This feature is so useful that I’m shocked it isn’t baked in to all email applications.