CLI wrapper for emailmd — write markdown, ship emails. Includes a Gmail send/draft tool via gws CLI.
git clone https://github.com/domocarroll/emailmd-cli.git ~/emailmd-cli
cd ~/emailmd-cli && chmod +x install.sh && ./install.shemailmd input.md # Writes input-email.html
emailmd input.md output.html # Writes to specific file
emailmd input.md --both # Writes .html + .txt
emailmd input.md --text # Plain text only
emailmd input.md --meta # Frontmatter metadata as JSON
cat input.md | emailmd > out.html # Stdin to stdoutRequires gws CLI authenticated with gmail.modify scope.
# Create a draft (review in Gmail before sending)
emailmd-send output.html --to user@example.com --subject "Hello"
# Send immediately
emailmd-send output.html --to user@example.com --subject "Hello" --sendThe send tool constructs a proper MIME multipart/alternative message with both text/html and text/plain parts. If a .txt file exists alongside the .html, it's included as the plain text fallback.
emailmd supports standard markdown plus email-specific extensions:
- Buttons:
[Label](url){button},{button.secondary},{button.success} - Directives:
::: header,::: hero,::: callout,::: highlight,::: footer - Theming: Dark/light via frontmatter (
theme: dark,brand_color: "#e11d48") - Images:
{width="400" align="center"} - Preheader:
preheader: "Inbox preview text"in frontmatter
See emailmd docs for the full syntax reference.
---
preheader: "Weekly update from the team"
theme: dark
brand_color: "#e11d48"
---
::: header left
**ACME Corp** | Weekly Update
:::
# This Week's Highlights
We shipped three features and closed 12 bugs.
[View Dashboard](https://example.com){button}
::: footer
[Unsubscribe](https://example.com/unsub) | ACME Corp
:::emailmd update.md --both
emailmd-send update-email.html --to team@example.com --subject "Weekly Update"cd ~/emailmd-cli && git pull && ./install.shMIT