Mail macro variable


How to use a variable to set a recipient or use a variable to change part of the mail text?

Thanks in advance.

Can you be more specific about

•which email app you’re using
•specific scenario(s) you would want to use this for (which part of the mail text exactly?)
•what you ultimately want to accomplish

For example, KM has built-in actions for sending emails through, but those wouldn’t help if you use a different app like Airmail or Spark. Basically, the more details about your setup, process, and goal(s) as you can offer, the more help we can offer.

Thanks for the quick answer.

I am using Mail app and would like to copy recipient’s email address from a browser then paste it to an email message and set it as “TO” / paste it in the mali’s body (between specific text).

Okay then, hopefully this will at least get you most of the way there:

Set Copied Email Address to "TO" Recipient of Front Outgoing Mail Message and Paste Between Specific Text.kmmacros (4.8 KB)

It sounded from your reply like the message you want to paste the variable into is already created, so I assumed that was the case and that it was the frontmost message. If that isn't the case, the macro will need to be adjusted accordingly (which is one reason why it's a good idea to provide as much detail as you can).

I renamed all of the action names to better explain what their purpose is, and left a comment explaining where to add the text you want the address pasted between. If you have further questions, feel free to ask.

Thanks a lot, will try it and reply.

Not exactly what expected, i am not well educated in appscript and it will be a problem to modify it.

Please take a look at the screenshot.

No need to copy it from To: (sorry for misunderstanding in my previous explanations).

I just need to set "" to a variable so every new email's text will be updated with the text from that variable.

Got it. Fortunately, that's much easier then what I thought you were attempting to do before:


1 Like


That’s what i have done by myself after some researching. Glad to know that i am doing right. Much respect for the help!

1 Like

The recipient receives an email with some additional text:

quiv=“Content-Type” content=“text/html charset=us-ascii”> -


If i am not using the Variable then there is no such text.

Does anyone know what it means and how can i fix it?

Thanks in advance.

Hey again @kreal,

I’m not seeing any text like that in my sample macro; what I showed you in the image in my last post is exactly what gets sent. Can you upload your full macro so we can get a more complete idea of how it’s supposed to work and what might be going wrong?

The problem is not in the macro, the problem is in the recipient's email address format:

I can't just copy it and the paste using a variable (in this case email will be sent with a error), the email address should be formatted like this:

It needs to be a hyperlinked as an email:

I just don't get it how to copy email address to clipboard and apply hyperlink format to it and then paste it using a variable.
Hope my explanations are clear enough.

Hmm. I’m not sure if this is even possible with KM’s “Send Mail” action, but as far as I can tell, finding a way to modify this macro by @JMichaelTX is your best bet: Set Clipboard to RTF Hyperlink & Plain Text MD Link

1 Like

Already trying to do something with it, thanks a lot for your help!

1 Like