Skip to content

domocarroll/emailmd-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

emailmd-cli

CLI wrapper for emailmd — write markdown, ship emails. Includes a Gmail send/draft tool via gws CLI.

Install

git clone https://github.com/domocarroll/emailmd-cli.git ~/emailmd-cli
cd ~/emailmd-cli && chmod +x install.sh && ./install.sh

Usage

Render markdown to email HTML

emailmd 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 stdout

Send via Gmail

Requires 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" --send

The 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.

Markdown Features

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: ![alt](url){width="400" align="center"}
  • Preheader: preheader: "Inbox preview text" in frontmatter

See emailmd docs for the full syntax reference.

Example

---
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"

Update

cd ~/emailmd-cli && git pull && ./install.sh

License

MIT

About

CLI wrapper for emailmd — render markdown to email-safe HTML + Gmail send via gws

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors