I run my own newsletter for this blog on Listmonk, an open-source mailing list manager, instead of paying Mailchimp every month. It lives on a small Ubuntu server, sends through Brevo's SMTP relay, and can turn new blog posts from the RSS feed into a weekly digest on its own. This guide covers the whole setup, from the first container to an automated weekly digest.
Quick answer
Run Listmonk and PostgreSQL with Docker Compose, put it behind HTTPS on a subdomain, and connect an SMTP relay such as Brevo. Add SPF, DKIM and DMARC records for your sending domain before the first send. To automate it, a short Python script reads your RSS feed, creates a campaign through the Listmonk API and starts it, run weekly by cron.
Why self-host your newsletter?
- Cost: Listmonk is free. You pay only for the server and the SMTP relay, and many relays have a free tier.
- Ownership: your subscriber list sits in your own database, not on a platform that can change its pricing or close your account.
- No limits on list size: Listmonk handles hundreds of thousands of subscribers on a small server.
The trade-off is that you are responsible for deliverability, backups and updates. If you only want to send a few emails a year, a hosted service is simpler.
What I used
| Part | What I use | Notes |
|---|---|---|
| Server | Ubuntu Server with Docker | Any small VPS or home server with 1 GB RAM works |
| App | Listmonk (latest) and PostgreSQL | Both in Docker Compose |
| Sending | Brevo SMTP relay | Port 587 with STARTTLS |
| Domain and DNS | A subdomain on Cloudflare | For HTTPS and the email DNS records |
| Automation | Python script and cron | RSS feed to weekly digest |
Step 1: Install Listmonk with Docker Compose
Create a folder such as /opt/listmonk and save this as docker-compose.yml. Change both passwords to the same long random value.
services:
db:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_USER: listmonk
POSTGRES_PASSWORD: change-this-password
POSTGRES_DB: listmonk
volumes:
- listmonk-db:/var/lib/postgresql/data
app:
image: listmonk/listmonk:latest
restart: unless-stopped
depends_on:
- db
ports:
- "127.0.0.1:9000:9000"
environment:
LISTMONK_app__address: "0.0.0.0:9000"
LISTMONK_db__host: db
LISTMONK_db__user: listmonk
LISTMONK_db__password: change-this-password
LISTMONK_db__database: listmonk
TZ: Asia/Kathmandu
command: [sh, -c, "./listmonk --install --idempotent --yes && ./listmonk --upgrade --yes && ./listmonk"]
volumes:
- ./uploads:/listmonk/uploads
volumes:
listmonk-db:
Start it with docker compose up -d. The first run creates the database tables. Port 9000 is bound to 127.0.0.1 on purpose, so it is only reachable through your reverse proxy and not straight from the internet.
Step 2: Put it behind HTTPS on a subdomain
Point a subdomain such as newsletter.yourdomain.com at the server and proxy it to 127.0.0.1:9000 with Nginx, Caddy or Nginx Proxy Manager. Caddy is the quickest because it gets the certificate for you. If your DNS is on Cloudflare, the record setup is the same as in my Cloudflare custom domain guide.
Open the subdomain in a browser. On first launch, Listmonk asks you to create the Super Admin account. Use a strong password, because this login controls your whole mailing list.
Step 3: Connect an SMTP relay
Do not send newsletters straight from a home IP or a fresh VPS; they are often on blocklists. Use a relay. In Listmonk, open Settings > SMTP and enter your provider's details. For Brevo:
| Setting | Value |
|---|---|
| Host | smtp-relay.brevo.com |
| Port | 587 |
| TLS | STARTTLS |
| Username and password | The SMTP login from your Brevo account |
Click Test connection and send a test email to yourself before going further.
Step 4: Add SPF, DKIM and DMARC
These three DNS records prove that your emails really come from your domain. Without them, Gmail and Outlook will put most of your newsletter in spam.
| Record | Type | Example value |
|---|---|---|
| SPF | TXT on @ | v=spf1 include:spf.brevo.com ~all |
| DKIM | TXT or CNAME | Copy exactly from your SMTP provider |
| DMARC | TXT on _dmarc | v=DMARC1; p=none; rua=mailto:you@yourdomain.com |
A domain can only have one SPF record. If you already send mail through Google Workspace or Microsoft 365, add the Brevo include to the existing record instead of creating a second one. Start DMARC on p=none, read the reports for a couple of weeks, then tighten it to quarantine.
Step 5: Lists, templates and subscribers
- Create a list under Lists. Pick Double opt-in for public sign-ups so nobody gets added without confirming.
- Under Campaigns > Templates, make one simple template with your logo, a content block and a footer with the unsubscribe link. Plain layouts land in the inbox more often than heavy designs.
- Import existing subscribers from a CSV under Subscribers > Import. Only import people who actually asked for your emails.
- Add the public subscription form to your site. Listmonk gives you the HTML under Lists > Forms.
Step 6: Automate a weekly digest from your RSS feed
This is the part that saves real time. Every week, a script reads the blog's RSS feed, builds an email from the posts that have not been sent yet, creates a campaign through the Listmonk API and starts it. A digest of three to five posts gets better clicks than one email per post, and it keeps you from flooding inboxes.
1. Create an API user. In Listmonk, go to Admin > Users, add a user of type API, and copy the token it shows. Give it a role that can only manage campaigns.
2. Install the libraries: pip3 install feedparser beautifulsoup4 requests
3. Save the script as /opt/newsletter/digest.py. Blogger feeds live at /feeds/posts/default?alt=rss on any Blogger site.
import json, os, requests, feedparser
from bs4 import BeautifulSoup
RSS_URL = "https://www.yourblog.com/feeds/posts/default?alt=rss"
LISTMONK = "https://newsletter.yourdomain.com"
API_USER = os.environ["LISTMONK_API_USER"]
API_TOKEN = os.environ["LISTMONK_API_TOKEN"]
LIST_ID = 3 # numeric list ID, not the UUID
STATE = "/opt/newsletter/sent.json"
sent = set(json.load(open(STATE))) if os.path.exists(STATE) else set()
posts = [p for p in feedparser.parse(RSS_URL).entries if p.link not in sent][:5]
if not posts:
raise SystemExit("Nothing new this week")
body = "<h2>New on the blog this week</h2>"
for p in posts:
summary = BeautifulSoup(p.summary, "html.parser").get_text()[:160]
body += f'<h3><a href="{p.link}">{p.title}</a></h3><p>{summary}...</p>'
auth = (API_USER, API_TOKEN)
r = requests.post(f"{LISTMONK}/api/campaigns", auth=auth, timeout=30, json={
"name": f"Weekly digest: {posts[0].title[:40]}",
"subject": "This week on the blog",
"lists": [LIST_ID],
"type": "regular",
"content_type": "html",
"body": body,
})
r.raise_for_status()
cid = r.json()["data"]["id"]
requests.put(f"{LISTMONK}/api/campaigns/{cid}/status", auth=auth, timeout=30,
json={"status": "running"}).raise_for_status()
json.dump(sorted(sent | {p.link for p in posts}), open(STATE, "w"))
print(f"Sent campaign {cid} with {len(posts)} posts")
The sent.json file remembers which posts already went out, so a quiet week sends nothing instead of repeating last week's email.
4. Schedule it with cron. Run crontab -e and add a line for every Friday at 9 a.m.:
0 9 * * 5 LISTMONK_API_USER=digest LISTMONK_API_TOKEN=your-token /usr/bin/python3 /opt/newsletter/digest.py >> /var/log/digest.log 2>&1
Keep the token out of the script itself so it never ends up in a Git repository or a screenshot.
Why the first emails go to spam, and how to fix it
A new sending domain has no reputation, so even a perfect setup can land in spam at first. What helps:
- Send to a small group of people who know you first, and ask them to reply or move the email to the inbox.
- Send on a steady schedule instead of in bursts.
- Remove addresses that bounce. Listmonk can do this automatically under Settings > Bounces.
- Check your setup at mail-tester.com before a big send.
Common problems
| Problem | Fix |
|---|---|
| API returns 401 or a login page | Use an API user and its token, not the admin login. Check the user has campaign permissions. |
| Campaign created but nothing sent | Check the list ID is the number, not the UUID, and that the list has subscribers. |
| SMTP test fails | Confirm port 587 with STARTTLS and that your server allows outgoing connections on 587. |
| Everything goes to spam | Check SPF, DKIM and DMARC all pass in the email headers, then build reputation slowly. |
Frequently asked questions
Is Listmonk free?
Yes. Listmonk is open source and free to self-host. You only pay for the server you run it on and for the SMTP relay that sends the emails, and many relays have a free tier for small lists.
Is Listmonk better than Mailchimp?
It depends on what you need. Listmonk costs far less and you own the data, but you handle hosting, deliverability and updates yourself. Mailchimp is easier and has an established sending reputation, but gets expensive as your list grows.
Can Listmonk send newsletters automatically?
Yes. Through its API you can create a campaign and start it from a script. Run the script with cron and it can turn your blog RSS feed into a weekly digest with no manual work.
Do I need SPF, DKIM and DMARC for a newsletter?
Yes. Gmail and Yahoo require authenticated email from bulk senders, and without these records most messages will be rejected or sent to spam.
Does this work with a Blogger RSS feed?
Yes. Every Blogger site has an RSS feed at /feeds/posts/default?alt=rss, and the script in this guide reads it directly.