awdeorio / mailmerge

A simple, command line mail merge tool.
MIT License
140 stars 41 forks source link

Markdown Support #26

Closed captn3m0 closed 5 years ago

captn3m0 commented 6 years ago

Instead of rewriting the message, I would like to write the text version in markdown, and have the html version auto-generated. Taking care of the multipart boundaries by hand and rewriting emails in HTML is just 😿

awdeorio commented 6 years ago

What might a work flow look like for authoring in Markdown? Maybe convert using Pandoc? Is there a command line flow that would approximate built-in support?

captn3m0 commented 6 years ago

I found some workflow approximations for this using mutt macros and pandoc: https://news.ycombinator.com/item?id=12325589, which links to https://unix.stackexchange.com/questions/108485/send-email-written-in-markdown-using-mutt

It might just work.

awdeorio commented 6 years ago

Cool! Maybe a README section for authoring with Markdown and conversion with Pandoc would be a good start. A PR along these lines would be very welcome!

seshrs commented 5 years ago

What do you think of modifying the email template to specify Markdown? Something like:

TO: {{email}}
SUBJECT: Testing mailmerge
FROM: My Self <myself@mydomain.com>
Content-Type: text/markdown

Hi, {{name}},

Your number is *{{number}}*.

Sent by [mailmerge](https://github.com/awdeorio/mailmerge)

Then if mailmerge detects the Markdown content type, it could use Python Markdown to construct the HTML version of the message.

Alternatively, perhaps users could run mailmerge with a flag --convert-markdown instead of specifying a content type in the message template?

awdeorio commented 5 years ago

I have a slight preference for a command line flag, e.g., --markdown. This seems like the least surprising approach to the end user. It's not obvious that Content-Type: text/markdown is a preprocessor directive to mailmerge. It could be confused with "please send this literal email header to the recipient".

Reference: Principle of least astonishment https://en.wikipedia.org/wiki/Principle_of_least_astonishment