0

I want to be able to schedule an e-mail or more of them to be sent on a specific date, preferably using GAE Mail API if possible (so far I haven't found the solution).

Would using Cron be an acceptable workaround and if so, would I even be able to create a Cron task with Python? The dates are various with no specific pattern so I can't use the same task over and over again.

Any suggestions how to solve this problem? All help appreciated

zbx
  • 279
  • 1
  • 3
  • 11

2 Answers2

2

You can easily accomplish what you need with Task API. When you create a task, you can set an ETA parameter (when to execute). ETA time can be up to 30 days into the future.

If 30 days is not enough, you can store a "send_email" entity in the Datastore, and set one of the properties to the date/time when this email should be sent. Then you create a cron job that runs once a month (week). This cron job will retrieve all "send_email" entities that need to be send the next month (week), and create tasks for them, setting ETA to the exact date/time when they should be executed.

Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58
0

Yes, sending emails from cron jobs is fairly common, exactly for the scheduling reason.

Unfortunately controlling cron jobs programatically is not (yet) possible. You may want to star Issue 3638: Cron jobs to be scheduled programatically

Meanwhile you could check this answer for a couple of alternatives: https://stackoverflow.com/a/37079488/4495081

Community
  • 1
  • 1
Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97