Skip to content

A Django project created using Celery and Redis, which allows sending both custom and scheduled default mails asynchronously.

Notifications You must be signed in to change notification settings

vuralmert/asynchronous-mail-celery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Asynchronous Mail App

Mail App with Django, Django Rest Framework, Celery, Redis and Docker

How Asynchronous Mail App Works?

  • A client can create a custom mail with Mail Form.
  • Each mail contains; to field, subject, body, cc and attachments.
  • Client can also schedule a mail that is set as default. (New features to be add)

Installation

  1. Get the code

    Clone the repository

    git clone https://github.com/vuralmert/asynchronous-mail-celery.git

  2. Install the project dependencies

    Enter the following command

    pip install -r requirements.txt

  3. Run the commands to generate the database

    Enter the following commands

    python manage.py makemigrations
    python manage.py migrate

Usage

Once you have complete dowloading requirements and migrating and none of the services failed after you have run the following command,

python manage.py runserver
  1. Access and Interact with API Front-end App (Django Rest Framework)
  2. The API Front-end application should be running and you can see it via your web browser at http://127.0.0.1:8000/mail_form which will take you to the main web app interface where you can create and send your mails.

    You can check your previous mails and use query parameters to filter, order or search them via your web browser at http://127.0.0.1:8000/send_mail which will take you to the Django Rest Framework interface where you can do these operations.

    For the developers I created a Swagger UI which you can access it via your web browser at http://127.0.0.1:8000/docs which will take you to the page that you can see all of your apis and schemas.

  3. Access Django Admin
    1. Create the admin user
    2. To access the admin interface first you gonna need to generate a super-user with the following command

      python manage.py createsuperuser
      You will be prompted to add a username and password for your user.

    3. Logging to admin interface
    4. Once you have complete creating the super-user you can visit http://127.0.0.1:8000/admin which will take you to the admin interface login screen. You should enter the username and password created in the previous step.

  4. Scheduling Mails with Celery
    1. To use this feature first you need to install Redis from https://redis.io/download/ and then config your Redis files. Once Redis server is installed, open the terminal and run the following command to start the server.

      redis-server
    2. Before running any commands or connecting any clients to the Redis server, you must ensure that Redis is running.

      redis-cli ping
      Returns PONG if the server is up and running.


    3. After making sure that Redis is installed and working properly enter the custom command that I created for ease of use of the codes we will use for Celery and Flower.

      python manage.py run_and_schedule
    4. The API Back-end application and tasks should be running and your scheduled mails will be sent to the active users you have created from the admin interface. You can check running and previous tasks via your web browser at http://127.0.0.6:5555 which will take you to the Flower interface.

Endpoints

  • GET /send_mail
  • POST /send_mail
  • POST /mail_form
  • GET /sent_mails
  • GET /schedule_mail

Used Technologies

  • Python
  • Django
  • Django Rest Framework
  • Celery
  • Redis
  • Flower
  • Docker

About

A Django project created using Celery and Redis, which allows sending both custom and scheduled default mails asynchronously.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published