How to Insert Variables Into Subject and Body of Send Mail Message With Subject Action

1- The subject and body don't seem to accept variables, which is surprising.
I can do it the long way (→ followed by 6 ⇥ ) but it's slow and cumbersome.

2- please note that I want to insert / paste rich text, not plain text. I mention this because KM Wiki reads :!: Note that this Keyboard Maestro form field supports only plain-text. If you want to enter rich-text, you will need to do so after you run this action.

3- I am also surprised that if I use the action alone, the email is created in the background. I have to add the activate Mail action before it to see the newly created email.

thanks in advance for your time and help

Hey @ronald,

Of course they do:

Make New Mail Message with Variables v1.00.kmmacros (6.0 KB)

Mail does not support creating messages with rich-text via AppleScript. It was possible somewhere pre-Sierra, but Apple in its infinite wisdom broke it and has chosen not to fix it.

Keyboard Maestro uses AppleScript behind the scenes in it's Send Mail action, so there's nothing to be done.

The only way is to create the message and then PASTE rich-text into the email body.

Yes, that's another quirk in the way AppleScript works with Mail.

Send Mail Message with Rich Text from Named Clipboard

-Chris

1 Like

many apologies for the delay. Fantastic reply. Extremely useful. All the contorsions I was going through and never getting anything close to your macro. Thank you so much !

1 Like

This Macro is great. Is it possible to extract the last name of the mail address to create a standard letter speech like "Dear Mr. Doe" in "mailbody"?
Andreas

Hey Andreas,

Yes. I've been doing that for about 25 years.

First with Eudora and now with Mail.

My macro for this is entirely AppleScript, but you can do almost entirely the same thing with Keyboard Maestro native actions.

Keyboard Maestro Text Tokens

Look under “M” for Mail.

Search using Regular Expression action

Search and Replace Variable action

Holler if you need help.

-Chris