Automatization is, most of the time, a personal matter. If the communication between two apps becomes widely used, it often indicates an issue with one of the parts. Knowing that, when Joe Kohlmann asked for a way to send markdown formatted emails from the clipboard, I couldn't just sit around and wait for a solution.
So let's consider that you write a beautiful email in markdown in your favorite text editor and copy it to the clipboard. If you open Drafts in an empty document and try to activate an action, you'll get an error. You must paste the content first and that's two taps. As you know, I take taps very seriously.
What's the best app to create magic with the content of your clipboard? That's right, Launch Center Pro. We'll create a one-tap action to format a markdown email to html and send it with a few details.
We'll use two Launch Center Pro actions, one of them for short emails, with a single paragraph, which will hold recipients and the subject, besides the content of the email, and another for longer emails, with line breaks, which will hold only the recipients OR the subject plus the content. Let's begin with the LCP action for short emails:
This will create a Drafts document with the clipboard content and activate the rule Markdown Short, as it follows:
Beware of an inception of actions. This action will call the Markdown: Copy to Clipboard default action from Drafts, then it will create another document and activate our custom Short Clipboard Mail action.
This last called action will trigger LCP again and place the first line as recipient, second line as subject and the clipboard as the email body. Yes, it works fast, Drafts never failed to call so many actions in a row. Poof, we're done. Next!
The aforementioned chain of actions rely on the recent [[line|#]] tag, so if our presumed text body has a single line break, it will be considered as a line and the following content as another. This is not really good since our Markdown: Copy to Clipboard action targets at the third line only. To solve this conundrum, we'll use our old friends [[title]] and [[body]]. First, add another action to LCP:
Afterwards, we'll begin with our chain of Drafts actions. You can assume how they work unless you skipped the whole article and just downloaded the actions (I don't mind if you do it though).
This example has the [[title]] as the recipients, just because I find it easier to type a subject then a bunch of contacts, but if you'd prefer to have your subject there, just replace
to from the Long Clipboard Mail action to
subject. No, I won't do it for you. See ya next time.
UPDATE: If you decide to create an action with the [[title]] as subject instead of recipients, there's an easier way to do it with the mail actions from Drafts. Create the following Launch Center Pro action:
And download this action: Markdown Email. It is a super simple mail action with content as [[body]], first line as subject and to be sent as markdown html.