Smarter Email Signatures With Keyboard Maestro

There are 2 things I don’t like about using signatures in Mail on the Mac.

For one, if you don’t always write messages which are either bottom-posted replies or top-posted replies, then half the time Mail puts the signature in the wrong spot. In the Signature preference pane you can check a box telling Mail to place the signature above quoted text, but then it’s in the incorrect place when you want to do a bottom-posted email reply. And vice versa. If you don’t check that box then your email signature is at the very bottom of the email message whenever you want to do a top-posted reply. Ugh.

Secondly, email signatures which are generated by Mail are in rich text. If, like me, you compose your emails in plain text then your signature can stand out like a formatted sore thumb.

For a long time I’ve been using TextExpander to expand my email signature when I’m done typing my email.

Ideally, however, I’d love to even forgo TextExpander and have my email signatures there before I even begin typing. But, as stated above, using Mail’s built-in signatures doesn’t place the signature in the right spot. And I want the signature inserted in the proper place regardless of if I’m composing a new message, top-posting my reply, or bottom-posting my reply.

Using Keyboard Maestro I can do just that.

Since Keyboard Maestro sees keyboard shortcuts before OS X does, it’s easy to “replace” an app’s default keyboard shortcuts with a Keyboard Maestro macro that does what you actually want the app to do when you hit that hotkey.

I set up five macros to replace my five most common email actions:

  • OPT+R: Bottom-posted, in-line reply (Since there is no default keyboard shortcut for bottom-posting a reply, I use Option+R. That way if I want to top-post my reply I use the default keyboard shortcut, or if I want to bottom post my reply then I use this alternate shortcut.)
  • CMD+N: New message
  • CMD+R: Top-posted Reply
  • SHIFT+CMD+R: Reply all
  • SHIFT+CMD+F: Forward

A few notes about these macros:

  • These macros assume you use non-account-specific signatures. If you do use a different signature for different email accounts, you could work around that by duplicating each macro for each specific signature you use. Then, give those signature-specific macros the same hotkey and Keyboard Maestro will ask you which signature you want to use.

  • The macro for bottom-posting a reply is based on this age-old AppleScript of John Gruber’s which I’ve been using for years. It essentially creates a better-formatted bottom-posted email reply by simulating some keystrokes and inserting the cursor in the proper place.

  • For creating a New Message, an AppleScript is used because when composing a new email you want the cursor to be in the “To:” field while the new message’s body already contains your signature. Running a simple inline AppleScript does the trick just fine for this:


    tell application "Mail"
        set theMessage to make new outgoing message with properties {visible:true, content:"

    — Shawn"}
    end tell
    
  • The macros for Top-Posted Reply, Forward, or Reply All, include two additional Return strokes underneath my name to give some breathing space below my signature and above the rest of the email message.

If you don’t use Keyboard Maestro that’s unfortunate. But you can still reap the rewards of this Mail hackery by whipping up some AppleScripts and using a hotkey launcher such as FastScripts or Alfred.

You can download the Keyboard Maestro macros here.

Smarter Email Signatures With Keyboard Maestro