How do I get Mail.app use a template?

Solution 1:

The Mail.app is scriptable, although AppleScript can be a little weird to work with. It wouldn't be hitting the reply button, but you can put a command in the Menu Bar under a Script Menu.

Much of the following comes from a discussions.apple.com thread (https://discussions.apple.com/thread/4401380):

Open the Script Editor (in Utilities) and go into its preferences and check "Show Script menu in menu bar"

Then create a new script with something like this:

set myReply to "Thanks, I've received your email. If I have any questions about it I will contact you directly"

tell application "Mail"
    set theSelection to selection
    if theSelection is {} then return
    activate
    repeat with thisMessage in theSelection
        set theOutgoingMessage to reply thisMessage with opening window
        repeat until exists (window 1 whose name = "Re: " & subject of thisMessage)
        end repeat
        delay 0.1

        -- send gui scripting to handler to get it out of Mail tell block
        my guiScriptMail(myReply)
        send theOutgoingMessage -- This automatically sends the message!
    end repeat
end tell

on guiScriptMail(myReply)
    tell application "System Events"
        tell process "Mail"
            set frontmost to true
            -- keystroke "a" using {command down} -- ⌘A to select all
            keystroke myReply
        end tell
    end tell
end guiScriptMail

Then save this script to the Desktop. In the Script menu, go to "Open Scripts Folder" and select "Open User Scripts Folder". In the folder that open up (should be ~/Library/Scripts) create a folder named "Mail" - this will create a context sensitive menu in the Scripts menu, so that it will only show your script if you are in the Mail application.

Then you can select a message in Mail, and then select the script in the Script menu and your reply should be filled out and sent.

Again, AppleScript can be a little tricky and can fail or hang sometimes, but works well most of the time.

Solution 2:

Unfortunately I don't know of any good way to do this within Apple Mail. There are a few close-ish things, but none are really solutions.

Automator Services

Automator contains the ability to create services—"contextual workflows" that can be run on specific items to process them. However, since it has no particular input format for emails, you'll likely be relegated to selecting the address or something of the sort, separately running the service, then using the output in your email. At that point, you're probably better off not using it.

enter image description here

Mail Stationary

Mail Stationary is, well, stationary. It's a template. However, their use is heavily restricted. First, they aren't context aware: unlike Pages templates, they have no ability to pull outside information and insert it. Instead, you've got to do all the work. Second, they don't work for replies, only new messages.

enter image description here

Other services

Outlook supports replies with specific templates via their more powerful Rules (which can be extended with third party extensions), unlike Apple Mail's rules (which can only be configured as basically an autoreply.) Gmail supports canned responses, albeit in a more limited format, as it exists outside the rules system.