Schedule emails in Django using Celery and Amazon SES

Viewed 1065

I'm finding very difficult to schedule emails in Django. I've been researching on the Internet but haven't been able to figure this out yet. Perhaps you can give me a hand on this or at least point me out in the right direction to find out how to do it.

For instance, when you use Mailgun, you can specify sending an email like this:

def send_scheduled_message():
    return requests.post(
        "https://api.mailgun.net/v2/samples.mailgun.org/messages",
        auth=("api", "key-3ax6xnjp29jd6fds4gc373sgvjxteol0"),
        data={"from": "Excited User <me@samples.mailgun.org>",
              "to": "bar@example.com",
              "subject": "Hello",
              "text": "Testing some Mailgun awesomness!",
              "o:deliverytime": "Fri, 25 Oct 2011 23:10:10 -0000"})

I would like to have something similar en Django to send emails where I can specify a delivery time, like in the previous case.

So far, I have installed django-SES and I'm able to send emails via Amazon SES. I have also installed Celery and used to have django-celery as well but it seems it is no longer required starting with Celery 3.1.

To sum up, how do I use send_mailto tell Celery to wait for a specific date and time to give the emails to django-SES so they can delivered on time?

Thank you for you help!

2 Answers
Related