A CLI tool for sending markdown-based newsletters via Postmark. This tool converts a Markdown file into HTML and sends it as an email newsletter to a list of recipients using Postmark's batch API.
- Secure Credentials: Uses keytar to securely store your Postmark API credentials and broadcast stream.
- Markdown to HTML: Converts Markdown files to HTML using markdown-it.
- CSV Parsing: Reads recipient emails from a CSV file.
- Batch Processing: Automatically splits messages into batches of up to 500 to comply with Postmark limits.
-
CLI Commands: Offers
validate
andsend
commands for configuration testing and sending emails.
Install the package globally from npm:
npm install -g batch-markdown-email
The CLI provides two commands: validate
and send
.
The send command sends your newsletter via Postmark. You can optionally provide the --apiKey and --broadcastStream flags; if omitted, you’ll be prompted to enter them.
batch-markdown-email send --markdown ./path/to/newsletter.md --subject "Your Subject" --to ./path/to/recipients.csv [--apiKey YOUR_POSTMARK_API_KEY] [--broadcastStream YOUR_FROM_EMAIL]
You should format your email csv like this:
Emails
test@email.com
test2@email.com
"Testing Name" <testingname@email.com>
Clone the repository and install dependencies:
git clone https://github.com/yourusername/batch-markdown-email.git
cd batch-markdown-email
npm install
Compile the TypeScript source code to JavaScript:
npm run build
You can test the CLI commands locally using:
npm run validate -- --markdown ./path/to/newsletter.md --subject "Test Subject" --to ./path/to/recipients.csv
npm run send -- --markdown ./path/to/newsletter.md --subject "Test Subject" --to ./path/to/recipients.csv
This project is licensed under the MIT License.