Workaround "Send message with Subject" text only limitation ?
I have a library of macros consisting of email templates. Those emails contain formatted text and annotated images. Because of the limitation of the send mail message action being text only, I have to append the annotated images as a PDF.
My problem would be solved if I could put everything (formatted text and images) in RTFD format. I know that the send mail message action is text only which cannot be circumvented. Is there any other way to create a series of macro email templates which would allow me to use the RTFD format ?
thank you very much
Have you tried putting your formatted text/images into Named Clipboards and Pasting from those, after making a new Mail message and Tabbing into the message body?
The problem with named clipboards is that the interface is so small in KM â Prefâ Clipboards, and therefore tedious to edit. I would prefer the paste RTF file route because easier to look at and edit in any RTF editor. The rtf files being stored in a dedicated directory.
Using tabs answers my question ie there is no direct way to put the cursor in the body
thank you
I'd save all my templates as RTFD, edit those files when required (and templates shouldn't need editing that often), then Copy/Paste those into Named Clipboards for use by KM. YMMV.
The other way I've used is make the templates in Mail and use the "Send Again" feature to generate the new email from the template. Quick web search found a decent walk-through of the process at How to Create Email Templates in Apple Mail - Eric Clark, but I'm sure that's not the only one.
Before reading your post, I decided to create a dedicated directory containing the RTF files â use the action below to read the content of the pertinent RTF to a variable â open the send email message action â paste into the body.
I am pulling my hair out trying to figure out why this action does not work. There is no mention in the Wiki that read file to variable is text only.
Engine Log
2025-02-13 20:36:54 Read File action failed to read text file with error Error Domain=NSCocoaErrorDomain Code=256 "The file âtest2.rtfdâ couldnât be opened." UserInfo={NSFilePath=/Users/Ronald/Downloads/test2.rtfd, NSUnderlyingError=0x600002292730 {Error Domain=NSPOSIXErrorDomain Code=21 "Is a directory"}} in macro âTryingâ (while executing Read File to Variable âinput_testâ).
That has nothing to do with text only. It has everything to do with the fact that an rtfd "file" isn't actually a file, but a folder of files. Right-click on an RTFD "file" and you can select Show Package Contents:
There's no way to assign the "file" to a variable because the file is a folder of files, basically.
No there isn't, but there's plenty of information about KM variables being text only. So my guess would be that reading a non-text file into a variable will give undesirable results? But I'd be happier if I were wrong!
Because of the security issues that have been known to arise with that proprietary Microsoft format [edit 2025-02-14: my wording was unclearâI was referring to RTF here, not PDF], and the decision of some sysadmins to block email that uses it, attaching images is a better course. That said...
Have you tried a workflow like this?
Macro 1:
Switch to RTF editor (and create an empty page if necessary).
Paste from Named Clipboard.
Edit the template then...
Macro 2:
Type a Keystroke for â-A.
Copy to Named Clipboard.
The .rtf file will be ASCII and the .png (or the whole folder) could be uuencoded but... that wouldn't take one very far.
I can't think of any way that's better than either pasting or templates for doing what you want. "Rich" outgoing Mail messages are... weird -- you're editing in what looks like Rich Text but that's only a halfway house to the HTML that's eventually generated when you hit "Send", and (seemingly) inaccessible programmatically from "outside".
And inlining your images only compounds the problem.
thank you all for your help @Nige_S@tiffle@Zabobon@griffman@kevinb
I remain a bit perplexed because your explain clearly the complexity of dealing with both text and images (files are in fact folders as per @griffman, conversion of emails to HTML etc) but ... the issue does not arise with using named clipboards as intermediary. What is special about Named Clipboards that allows them to handle text + images ?
A Named Clipboard is not a true clipboard like the Macâs System Clipboard. Rather it is simply a means to permanently store (like a file does) clipboard contents (like images or styled text) that can later be used to place on the System Clipboard.
Variables contain only plain, un-styled, text and may be used in any token text field in an action, as well as in Calculations in a numerical field if they contain a valid number or expression.
So basically, they act the way they do because that's how they were written. (And if variables were allowed to hold anything other than unstyled text, it would greatly complicate their use almost everywhere throughout Keyboard Maestro.)
Adding to @griffman's excellent points -- a lot of very clever people have spent a lot of time making Copy and Paste a collaboration between the System Clipboard and applications. When you Copy something you often get multiple "flavours" of the data -- when you Paste the receiving app can select the most appropriate flavour to use to suit its capabilities.
Named Clipboards work via the System Clipboard, so they have the same versatility.
So you are leveraging the built-in abilities of TextEdit and Mail to exchange combined text and images, in the best way they can, via the System Clipboard -- and, now, Named Clipboards as intermediate storage -- while letting TextEdit worry about how to read and present an RTFD, and Mail how to convert that mix of text and images to a sendable email.
thank you
As a general principle, if you are sending an email to someone in a company or a public institution (ie with more strict email rules), is it OK to send emails with images or better to send as an attached PDF (a big pain in the neck)