Django email backend with AWS SES and Celery

Overview

Django Celery SES

PyPI Version Build Status Coverage Status

Django Email Backend with Amazon Web Service SES and Celery, developed and used by StreetVoice.

This packages provide a EmailBackend to utilize django-celery to send email. You can just plug the EmailBackend in your project without any modify with your code.

Since Amazon SES requires you to handle Bounce email from SNS notification, django-celery-ses also provides view to handle SNS notification for email address which is blacklisted in Amazon SES.

What is provided

  1. Celery EmailBackend
  2. SNS notification handler
  3. Blacklist to handle Bounce email

Installation

  1. Install from pip / easy_install
$ pip install django-celery-ses
  1. Add djcelery_ses to INSTALLED_APPS in settings.py
INSTALLED_APPS = (
    ...
    'djcelery_ses',
    ...
)
  1. migrate the database with South ( you have to install South )
$ ./manage.py migrate
  1. Change the EMAIL_BACKEND
EMAIL_BACKEND = 'djcelery_ses.backends.CeleryEmailBackend'
  1. Add djcelery_ses in urls.py
urlpatterns = patterns('',
    ...
    (r'^djcelery_ses/', include('djcelery_ses.urls')),
    ...
)

Configuration

django-celery-ses uses Amazon SES through SMTP, so you have add EMAIL_* configuration in settings.py

EMAIL_USE_TLS = True
EMAIL_HOST = 'email-smtp.us-east-1.amazonaws.com'
EMAIL_HOST_USER = '<YOUR_AWS_ACCESS_KEY_ID>'
EMAIL_HOST_PASSWORD = '<YOUR_AWS_SECRET_ACCESS_KEY>'
EMAIL_PORT = 587

SERVER_EMAIL = 'StreetVoice <[email protected]>'
DEFAULT_FROM_EMAIL = 'StreetVoice <[email protected]>'

Besides these settings, you also have to setting the SES / SNS on AWS to make this package handle bounce mail for you.

How to use

All you have to do is use send_mail or EmailMessage just like the old time, you don't have to change your code.

Utilities

This package handle Blacklist for you by default, but sometimes, maybe you want to bypass the "blacklist check", you can use pass_blacklist to pass the "backlist check" like this.

from djcelery_ses.utils import pass_blacklist
from django.core.mail import EmailMessage

with pass_blacklist:
    msg = EmailMessage('title', 'body content', '[email protected]', ['[email protected]'])
    msg.send()

or in some situations, you don't want the email to send through Celery queue, you can use no_delay, for example.

since version 0.9

from djcelery_ses.utils import no_delay
from django.core.mail import send_mail

with no_delay:
    send_mail('title', 'body content', '[email protected]', ['[email protected]'])

with no_delay your email will send out directly without Celey queue.

Test

In order to ensure your changed which can pass in local environment, please run the script:

make test
Owner
StreetVoice
StreetVoice
Flower is a web based tool for monitoring and administrating Celery clusters.

Real-time monitor and web admin for Celery distributed task queue

Mher Movsisyan 5.5k Jan 02, 2023
Accept queue automatically on League of Legends.

Accept queue automatically on League of Legends. I was inspired by the lucassmonn code accept-queue-lol-telegram, and I modify it according to my need

2 Sep 06, 2022
PostgreSQL-based Task Queue for Python

Procrastinate: PostgreSQL-based Task Queue for Python Procrastinate is an open-source Python 3.7+ distributed task processing library, leveraging Post

Procrastinate 486 Jan 08, 2023
Sync Laravel queue with Python. Provides an interface for communication between Laravel and Python.

Python Laravel Queue Queue sync between Python and Laravel using Redis driver. You can process jobs dispatched from Laravel in Python. NOTE: This pack

Sinan Bekar 3 Oct 01, 2022
Py_extract is a simple, light-weight python library to handle some extraction tasks using less lines of code

py_extract Py_extract is a simple, light-weight python library to handle some extraction tasks using less lines of code. Still in Development Stage! I

I'm Not A Bot #Left_TG 7 Nov 07, 2021
A multiprocessing distributed task queue for Django

A multiprocessing distributed task queue for Django Features Multiprocessing worker pool Asynchronous tasks Scheduled, cron and repeated tasks Signed

Ilan Steemers 1.7k Jan 03, 2023
Django email backend with AWS SES and Celery

Django Celery SES Django Email Backend with Amazon Web Service SES and Celery, developed and used by StreetVoice. This packages provide a EmailBackend

StreetVoice 30 Oct 24, 2022
A simple app that provides django integration for RQ (Redis Queue)

Django-RQ Django integration with RQ, a Redis based Python queuing library. Django-RQ is a simple app that allows you to configure your queues in djan

RQ 1.6k Dec 28, 2022
A Django app that integrates with Dramatiq.

django_dramatiq django_dramatiq is a Django app that integrates with Dramatiq. Requirements Django 1.11+ Dramatiq 0.18+ Example You can find an exampl

Bogdan Popa 261 Dec 25, 2022
SAQ (Simple Async Queue) is a simple and performant job queueing framework built on top of asyncio and redis

SAQ SAQ (Simple Async Queue) is a simple and performant job queueing framework built on top of asyncio and redis. It can be used for processing backgr

Toby Mao 117 Dec 30, 2022
OpenQueue is a experimental CS: GO match system written in asyncio python.

What is OpenQueue OpenQueue is a experimental CS: GO match system written in asyncio python. Please star! This project was a lot of work & still has a

OpenQueue 10 May 13, 2022
Distributed Task Queue (development branch)

Version: 5.1.0b1 (singularity) Web: https://docs.celeryproject.org/en/stable/index.html Download: https://pypi.org/project/celery/ Source: https://git

Celery 20.7k Jan 01, 2023
A fast and reliable background task processing library for Python 3.

dramatiq A fast and reliable distributed task processing library for Python 3. Changelog: https://dramatiq.io/changelog.html Community: https://groups

Bogdan Popa 3.4k Jan 01, 2023
Dagon - An Asynchronous Task Graph Execution Engine

Dagon - An Asynchronous Task Graph Execution Engine Dagon is a job execution sys

8 Nov 17, 2022
A fully-featured e-commerce application powered by Django

kobbyshop - Django Ecommerce App A fully featured e-commerce application powered by Django. Sections Project Description Features Technology Setup Scr

Kwabena Yeboah 2 Feb 15, 2022
a little task queue for python

a lightweight alternative. huey is: a task queue (2019-04-01: version 2.0 released) written in python (2.7+, 3.4+) clean and simple API redis, sqlite,

Charles Leifer 4.3k Jan 08, 2023
Beatserver, a periodic task scheduler for Django 🎵

Beat Server Beatserver, a periodic task scheduler for django channels | beta software How to install Prerequirements: Follow django channels documenta

Raja Simon 130 Dec 17, 2022
Asynchronous serverless task queue with timed leasing of tasks

Asynchronous serverless task queue with timed leasing of tasks. Threaded implementations for SQS and local filesystem.

24 Dec 14, 2022
FastAPI with Celery

Minimal example utilizing fastapi and celery with RabbitMQ for task queue, Redis for celery backend and flower for monitoring the celery tasks.

Grega Vrbančič 371 Jan 01, 2023
RQ (Redis Queue) integration for Flask applications

Flask-RQ RQ (Redis Queue) integration for Flask applications Resources Documentation Issue Tracker Code Development Version Installation $ pip install

Matt Wright 205 Nov 06, 2022