Search code examples
djangodjango-mailer

deferred email sending in django?


Is there an easy way to be able to send an email at a later time, say Aug 1, 2012 6 pm? I have tried to read some documentation on django-mailer, but I could not get to an answer.

I am starting out in web development so may not be able to hack the existing application of django-mailer to get this done.


Solution

  • Celery can fit your need.

    First set up a celery task:

    @task
    def sendmail():
        pass
    

    Send a mail later, an example from the doc:

    from datetime import datetime, timedelta
    
    tomorrow = datetime.now() + timedelta(days=1)
    sendmail.apply_async(args=[], eta=tomorrow)