I wanted to take an email from Apple Mail and paste it to my blog.
If I copy/paste from the normal email, I lose the
> marks you need for proper quoting in Markdown.
Ah but there’s the option to view the Raw Source of an email in Apple Mail (Opt-Cmd-U).
But if you paste from that you get something like this:
British=E2=80=94again, really English=E2=80=94society remained defined =
by a national culture that Orwell would have recognized. In that year, =
however, Tony Blair=E2=80=99s just-elected first Labour government =
launched a demographic=E2=80=94and, concomitantly, a =
cultural=E2=80=94revolution, a revolution that historians and =
commentators of all political stripes now recognize as by far Blair=E2=80=99=
s most historically significant legacy.
ewww what are those =E2=80=blahblahs 🙁
Turns out Raw emails are encoded in Quoted-Printable. Ok cool, so how do we deal with that?
First we will need a gem.
gem install clipboard
gem install mail
Clipboard lets you easily interact with Mac clipboard, and Mail has a thing that lets us decode Quoted-Printable text to normal text.
The workflow is: I view Raw Source on an email I wanna paste, and select the body of the email, and copy it into the clipboard. Then I run the following script:
and now I have the plain text of my email with the appropriate
> marks. Nice!
However, this would be a lot better if I could set this up as a system wide service I could summon with a shortcut key….but I’m not sure if its possible to use an environment besides the system default Ruby to set such a service up in Automator.