Search code examples
djangodjango-email

Is it possible to send date triggered email in Django?


I am wondering if it is possible to send an email before a certain date? To explain a bit more we have talks that run every month on the second Wednesday of the month and they have a title and speaker.

I would like to email the members (email addresses stored in member object) 2 weeks before each meeting so on the first of the month yet get this months talk. So is this possible? The dates for each talk are stored in the talk objects. The basic outline of the email would just consist of the information in this months talk object.


Solution

  • You can use a cron job or, better yet, a message queuing service such as RabbitMQ or ZeroMQ. Celery is a project that wraps these message queuing services in a python/django module.

    The way it would work is you'd write a function that would do your database queries and figure out which messages to send. You'd then decorate this function as a task and set a delayed execution time on it.