A Python-based email sender for personalized newsletters using HTML templates, TXT content, and a recipient list. Supports inline images, HTML formatting, and plain-text fallback.
├── email-content.example.txt # Example content file (subject + body)
├── email-list.example.txt # Example recipient list
├── email-template.jinja # HTML email template
├── README.md # This file
├── requirements.txt # Python dependencies
└── src
└── main.py # Main script to send emails
After setup:
.env # Environment variables
email-content.txt # Your actual newsletter content
email-list.txt # Your actual recipient list
venv/ # Python virtual environment
- Batch email sending
- HTML emails with plain-text fallback
- Simple file-based configuration
git clone https://github.com/karume-lab/pymailer
cd pymailerpython -m venv venv
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activatepip install -r requirements.txtCopy .env.example to .env and fill in your SMTP credentials.
For Gmail, you must use an App Password with 2‑Step Verification enabled.
Instead of writing content directly in this README, pymailer uses example files as templates. Copy the example files and edit them for your own use.
Copy the example file:
cp email-list.example.txt email-list.txtEdit email-list.txt to include one email address per line.
Copy the example content file:
cp email-content.example.txt email-content.txtThe format is:
- First line: Email subject
- Remaining lines: Email body (plain text)
Refer to email-content.example.txt for a complete working example.
email-template.jinja defines the HTML layout for your email. The rendered email body will be injected using the {{ content }} placeholder.
You can customize styling and layout directly in this file.
Run the main Python script:
python src/main.pyThis will:
- Load recipients from
email-list.txt - Load subject and body from
email-content.txt - Send an HTML email (with plain-text fallback) to each recipient
- Always test with a small recipient list first
- Double‑check SMTP credentials before large sends
- This tool is intentionally minimal: it sends batch emails, nothing more, nothing less