September 1, 2025

Gmail-Based Newsletter System: Zero Cost, Total Control

Gmail Newsletter System

Why This Works Better

Advantages over third-party services:

System Architecture

Your Script → Gmail SMTP → Subscribers
     ↑              ↑           ↑
Custom HTML    Your Gmail   Your List
Templates      Account      (<500 people)
            

Technical Implementation

Step 1: Gmail App Password Setup

Why needed: Gmail requires "App Passwords" for external applications (not your regular password).

Enable 2-Factor Authentication

  1. Go to Google Account Security
  2. Click 2-Step Verification
  3. Follow setup process (required for App Passwords)

Generate App Password

  1. Go to App Passwords
  2. Select Mail and Other (Custom name)
  3. Enter: "Newsletter System"
  4. Save the 16-character password (you'll only see it once)

Step 2: Python Environment Setup

Install Dependencies

pip install smtplib email html2text python-dotenv

Project Structure

gmail_newsletter/
├── .env                    # Gmail credentials
├── config.py              # Configuration
├── subscribers.json        # Subscriber database
├── templates/
│   ├── newsletter.html     # Email template
│   └── images/            # Optional local images
├── send_newsletter.py     # Main sending script
└── subscriber_manager.py  # Subscriber management
        

Step 3: Core Implementation

Configuration (.env)

# Your Gmail credentials
GMAIL_USERNAME=your-email@gmail.com
GMAIL_APP_PASSWORD=your-16-character-app-password

# Newsletter settings
FROM_NAME=Your Newsletter Name
REPLY_TO=your-email@gmail.com

# Image hosting
IMAGE_BASE_URL=https://9to5ninjas.live/newsletter-images/
        

Subscriber Database (subscribers.json)

{
    "subscribers": [
        {
            "email": "subscriber1@example.com",
            "name": "John Doe",
            "subscribed": true,
            "signup_date": "2024-01-15",
            "tags": ["newsletter", "tech"]
        }
    ],
    "unsubscribed": [],
    "bounced": []
}
        

Usage Examples

Send Test Email

python send_newsletter.py --test your-email@gmail.com --subject "Test Newsletter"

Send to All Subscribers

python send_newsletter.py --subject "Weekly Update - New System!"

Send with Custom Content

echo "<h2>This Week</h2><p>Content...</p>" > content.html
python send_newsletter.py --subject "Weekly" --content-file content.html
        

Image Hosting Strategy

Option 1: Use Your Existing Website

Upload newsletter images to your 9to5ninjas.live site:

https://9to5ninjas.live/newsletter-images/header.jpg
https://9to5ninjas.live/newsletter-images/feature-1.png
        

Option 2: GitHub Repository

Create a newsletter-images repo:

Cost Comparison

Traditional Services:
• Mailchimp: $10-30/month + restrictions
• SendGrid: "Free trial" → subscription pressure
• ConvertKit: $29/month minimum

Gmail System:
• Cost: $0/month
• Control: 100%
• Capacity: 500 emails/day (15,000/month)

Technical Benefits

Security Best Practices

Gmail Security

Data Protection

Troubleshooting Guide

"Authentication Failed" Error

Solution:

  1. Verify 2FA is enabled on Gmail account
  2. Regenerate App Password if needed
  3. Check .env file has correct credentials
  4. Ensure no extra spaces in password

Emails Going to Spam

Solution:

  1. This is normal for new sending patterns
  2. Ask subscribers to check spam initially
  3. Mark as "Not Spam" to train filters
  4. Deliverability improves with consistent sending

Complete Python Implementation

The full implementation includes:

All code is production-ready with error handling, rate limiting, and personalization features.

Success Metrics

Technical Metrics:
• Email Delivery Rate: Should be >95%
• Template Rendering: Images and formatting correct
• Error Rate: <5% failed sends

Business Metrics:
• Cost Savings: $0 vs. previous Mailchimp costs
• Subscriber Growth: Track additions/removals
• System Reliability: Consistent weekly sends

Conclusion

This Gmail-based system gives you everything you need:

Perfect for indie creators, small businesses, and anyone who wants complete control over their email infrastructure without the monthly fees.

Want the complete code? The full implementation with all modules, templates, and documentation is available on our GitHub repository.

Support the experiments

☕ Buy me a coffee on Ko-fi