How paulledemon/email-automation works
Project Type and Purpose
• This is a full-stack, open-source email automation (cold outreach) tool built on Django (MVT pattern).
• It combines a web UI (templates + static assets), a REST/API layer, a relational database, and asynchronous background processing (Celery + Redis) to schedule and send personalized bulk emails via external SMTP/IMAP services.
Main Components
a. Client Layer (Browser)
• Loads HTML/CSS/JS (Django templates, staticfiles, theme assets).
• Executes client-side validation via Nunjucks and dynamically loads content (email templates, campaign UIs).
b. Web Application Layer (Django)
• URL routing (email_automation/urls.py, automail/urls.py, user/urls.py, blog/urls.py).
• Views/Controllers (email_automation/views.py, automail/views.py, etc.).
• Templates (Jinja2 for email rendering; Django templates for UI).
• Static Assets (Tailwind-generated CSS, JS modules under staticfiles/ and theme/static/).
• Admin site (automail/admin.py, blog/admin.py, user/admin.py) for configuration.
c. Data Layer (PostgreSQL)
• Persistent storage for users, templates, campaigns, configurations, follow-up rules.
• Django ORM models (in automail/models.py, user/models.py, blog/models.py).
d. Messaging Layer
• Message broker & scheduler (Redis).
• Beat scheduler via django_celery_beat (storing schedule entries in the DB).
e. Background Workers
• Celery workers (tasks defined in utils/tasks.py, automail/signals.py triggers).
• Send emails asynchronously, query the database, update campaign status.
f. External Services
• SMTP/IMAP servers (third-party email providers or self-hosted).
• Optional: Firebase for push notifications (if configured).
Relationships & Data Flows
• Browser → HTTP(s) → Django Web Server → Database (read/write)
• Django schedules jobs → Redis (broker) → Celery Beat → Celery Worker
• Celery Worker → Database (update status)
• Celery Worker → External SMTP/IMAP → Recipient Mailboxes
• Django → External Email Services (on-demand sends / config tests)
Architectural Patterns & Principles
• Django MVT (separate models, views/controllers, templates).
• Asynchronous task queue (Celery) for long-running email sends and follow-ups.
• Scheduler (django_celery_beat) for periodic tasks (follow-up rules).
• Modular “apps” structure (automail, user, blog, theme).
• Configuration via environment variables (.env in email_automation/settings.py).
Technologies to Annotate
• Backend: Python 3.8+, Django, Celery, django_celery_beat, Jinja2 (email rendering).
• Frontend: Django templates, static JS (Nunjucks validation), Tailwind CSS.
• Data Store: PostgreSQL.
• Broker/Cache: Redis.
• Deployment: WSGI/ASGI (gunicorn/daphne), Procfile (e.g., Heroku), possible Vercel/Render/Railway.