Skip to content

shariski/python-email-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Email Queue Worker

A lightweight web server and worker for scheduling and executing email delivery tasks.
Tasks are executed based on their scheduled timestamp, with built-in retry and monitoring features. Docs: https://gitlab.com/shariski/jublia-test


Core Concepts

  • Single Project, Dual Roles
    • Web server to handle email scheduling.
    • Worker process to execute email delivery.
  • Tech Stack: Python, Flask, and SQLite (embedded DB, no external setup required).

Features

  • Asynchronous Background Execution
    Emails are queued and delivered in the background without blocking the web server.

  • Delivery Throttling
    Each worker run is limited to 10 emails, preventing providers from flagging or blocking mass sends.

  • Exponential Backoff
    Failed tasks are automatically rescheduled with backoff logic:
    next_execution_time = last_execution_time + (2 ** retries_count)
    ensuring retries don’t block new tasks.

  • Lightweight & Embedded
    Powered by SQLite—no database server configuration required.

  • Easy to Deploy
    Fully containerized and ready to run with Docker.

  • Simple Web UI
    Monitor and manage your email queue directly from a browser.


Installation

Run the Web Server

docker run -d --name web \
  -p 8888:8888 \
  -v shared_data:/app/data \
  -e FLASK_SECRET_KEY=verysecretkey \
  -e SQLALCHEMY_TRACK_MODIFICATIONS=false \
  registry.gitlab.com/shariski/jublia-test

Run the Worker

docker run -d --name worker \
  -v shared_data:/app/data \
  -e MAIL_SERVER=smtp.gmail.com \
  -e MAIL_PORT=587 \
  -e MAIL_USE_TLS=true \
  -e MAIL_USERNAME=your@email.com \
  -e MAIL_PASSWORD=youremailapppassword \
  -e MAIL_DEFAULT_SENDER="Jublia Test <your@email.com>" \
  registry.gitlab.com/shariski/jublia-test \
  python -u worker.py

GUI Access


API Reference

POST /save_emails

  • Description: Schedule an email for delivery.
  • Parameters:
    • event_id (integer)
    • email_subject (string)
    • email_content (string)
    • timestamp (datetime, SGT)
  • Returns: The scheduled email delivery task (JSON).

Contributing

Contributions are welcome!
Please open an issue or submit a pull request.


License

MIT © Falahudin Halim Shariski

About

A web and worker service to schedule email delivery, built using flask and pure python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published