Sending Emails in Django With Celery

Pretty Printed · 81K views · 2019 · 23:20

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering or asking about moving email sending in Django into asynchronous Celery tasks.

Recommended by 1 people across 1 different months, 2020 to 2023.

What it is

A roughly 23-minute tutorial from the Pretty Printed channel showing how to set up Celery in a Django app with a Redis broker and use it to send emails as a background task. The presenter notes the approach also works for any other long-running process in a web app.

What people said

Recommends Kenny Aires · 2020-02 · Stack Overflow · on “Django - how to redirect while sending mail”

Seems like a good reason to upgrade your application by using a async task manager such as Celery. There's a very good tutorial seting up celery and the async email sender task on a django app [this video] . Once you have celery installed and an instance of it running - check out the tutorial -, you can write a similar function like the following: from celery import shared_task from django.core.mail import send_mail @shared_task def send_email_task(): send_mail('Celery Task Worked!', 'This is proof the task worked!', 'support@prettyprinted.com', ['sasa@be-breathtaking.net']) return None On your django route you can call the async task, this way your user won't have to wait the e-mail to be sent i

Cites user13486660 · 2020-08 · Stack Overflow · on “Gmail Schedule Send Email in Django”

@TimofeyKatalnikov I am watching this video: [this video] and it says I need a celery server. Whereas `django-cron` does not need that, right?

Cites Carewen · 2023-02 · Stack Overflow · on “Django with Celery on Digital Ocean”

The Objective I am trying to use Celery in combination with Django; The objective is to set up Celery on a Django web application (deployed test environment) to send scheduled emails. The web application already sends emails. The ultimate objective is to add functionality to send out emails at a user-selected date-time. However, before we get there the first step is to invoke the delay() function to prove that Celery is working. Tutorials and Documentation Used I am new to Celery and have been learning through the following resources: First Steps With Celery-Django documentation: [LINK] A YouTube video on sending email from Django through Celery via a Redis broker: [this video] The Redis/Celery d