Look Up Email Address in Contacts

Is it possible for Keyboard Maestro to:

  • Ask me to input a name.
  • Have the macro search for the email address of that name in my contacts.
  • Insert the email address into the 'To' field of a new email in Mail.

See Extract portion of captured text for some clues...

Hey Ross,

Yes to all.

But you'll have to have Contacts running in order to script it. (Or launch it every time.)

  • Insert the email address into the 'To' field of a new email in Mail.

Do you mean you want Keyboard Maestro to create the new email?

You might want to explain your workflow a little more completely.


Hopefully I've attached the macro I've made so far. This nearly does what I want. But I need the email address of %Variable%Recipient% to be inserted into the To field.

Email.kmmacros (4.6 KB)

Hey Ross,

This gets tricky.

Unless you know exactly what result you're going to get from a given search string, you might get more than one email address returned.

So – the appended macro pops up a pick-list IF more than one email address is found.


Scripting Contacts v1.00.kmmacros (9.2 KB)


That solution is excellent, many thanks.

Only issue I having is that my signature is not appearing in the new email. The signature is set to 'none' when the new email opens. I then have to go to the drop down menu in the new email for my signature to appear.

Do you know how to get the default signature for my email account to appear?

Hey Ross,

The Keyboard Maestro action doesn't support signatures, because Apple broke AppleScripted signatures as of macOS Sierra – and they've never bothered to fix them. (Bad Apple!)

So you have 3 choices:

  1. Manually select the signature.

  2. Use a keyboard shortcut for the signature. (Do this in the System Prefs ⇢ Keyboard ⇢ Shortcuts ⇢ App Shortcuts.


  1. Script the choice with AppleScript UI-Scripting.

I recommend option 2.

Please take the time to complain to Apple.

Feedback - Mail - Apple


Thanks Chris. I've added a few ‘type keystroke’ actions onto end of macro to click on the signature drop down menu. Appears to work ok.

That works.

But I'd rather use the System Keyboard prefs and give the signatures in question actual keyboard shortcuts.


On the other hand – if I was dealing with a whole lot of signatures I might very well prefer to pop-up the menu and type-select.


Hi Chris this very useful macro that you did has suddenly stopped working. I think the problem is the AppleScript action near top. Do you know what problem?

This is error message:

Execute an AppleScript failed with script error: text-script:274:341: execution error: Not authorised to send Apple events to Contacts. (-1743). Macro "Trying" cancelled (while executing Execute AppleScript).

If you are using macOS Ventura, AppleScript integration with Contacts has a bug which is not yet fixed:

1 Like

Hey Ross,

See @Zabobon's post above.

What version of macOS are you using?

Have you made changes to your system lately?


I'm on Ventura 13.0. Hopefully will be fixed soon.

Make sure you complain to Apple! Every little bit helps...

Feedback - macOS - Apple

UPDATE - this AppleScript Contacts bug appears to have been fixed by Apple in Ventura 13.1

1 Like