nori-newsletter-cli
v1.0.0
Published
CLI for managing and sending newsletters via AWS SES
Readme
nori-newsletter-cli
CLI for managing and sending newsletters via AWS SES. Handles subscriber management through SES contact lists, CSV import, and individual email sending with automatic unsubscribe support.
Setup
npm install
npm run buildAWS Credentials
Configure AWS credentials via environment variables or a .env file:
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_REGION=us-east-1Newsletter Configuration
Create a newsletter.config.json in your project root:
{
"contactListName": "my-newsletter",
"topicName": "weekly-updates",
"fromAddress": "My Newsletter <[email protected]>",
"replyTo": "[email protected]"
}See newsletter.config.example.json for a template.
Usage
Initialize the contact list
Creates the SES contact list and topic defined in your config:
nori-newsletter initManage subscribers
nori-newsletter contacts add [email protected]
nori-newsletter contacts add [email protected] --name "Jane" --company "Acme"
nori-newsletter contacts import subscribers.csv
nori-newsletter contacts list
nori-newsletter contacts remove [email protected]The CSV format expects columns: email,name,company,added_date.
Send a newsletter
# Send to all subscribers
nori-newsletter send newsletter.html
# Test send to specific recipients
nori-newsletter send newsletter.html --test [email protected]
# Preview without sending
nori-newsletter send newsletter.html --dry-runThe subject line is extracted from the HTML <title> tag. If no title is found, the filename is used.
Unsubscribe handling
When sending via ListManagementOptions, SES automatically:
- Adds
List-Unsubscribeheaders (RFC 8058) for Gmail/Yahoo compliance - Replaces
{{amazonSESUnsubscribeUrl}}in your HTML with a managed unsubscribe link
Include {{amazonSESUnsubscribeUrl}} in your newsletter footer for in-body unsubscribe links.
Development
npm run dev -- init # Run via tsx without building
npm test # Run tests
npm run test:watch # Watch modeLicense
Apache-2.0
