On publishing emails

← Back to Kevin's homepagePublished: 2018 December 31

Why publish emails?

It takes me forever to write articles: My pace is around 200 words/hour, so a typical article takes several days to compose and publish (not counting the time spent to explore the underlying ideas).

Somehow, I find emails much easier to write.

I don’t know if it’s the shared context of a specific correspondent, the intellectual prompting of a back-and-forth dialog, or just that it feels more casual. But whatever the reason, I find myself sitting on email threads filled with interesting, useful ideas.

While I don’t have the energy to distill all such threads into articles, the next best thing is to just publish them as-is. (With the permission of my correspondents of course!)

Other rationales

Technical HOWTO

I use Gmail for emails and use slim templates on this website. To publish an email thread, I:

const get_nodes = ($el, selector) => Array.from($el.querySelectorAll(selector));

//Remove collapsed thread button
get_nodes(document, ".ajU").forEach($n => $n.remove())

var messages = get_nodes(document, ".adn").map($msg => {
  return {
    from_address: $msg.querySelector(".gD").getAttribute("email"),
    from_name: $msg.querySelector(".gD").getAttribute("name"),
    date: $msg.querySelector(".g3").innerText.replace(/\(.*\)/, "").trim(),
    body: $msg.querySelector(".a3s div[dir='ltr']").outerHTML
  };
});


var slim_markup = messages.map(({from_name, from_address, date, body}) => {
  return `
.email
  .metadata
    .name
      | ${from_name}
    .address
      | ${from_address}
    .date
      | ${date}
  .body
    | ${body}
`
}).join("\n")

//Chrome Devtools has a built-in copy-to-clipboard function
copy(slim_markup)