开发者

How to send an email to a list of email in a kind in Google app engine?

开发者 https://www.devze.com 2023-02-17 04:58 出处:网络
HY! I have a list in GAE, around 300 entries and I would like to send an email to everyone. I\'ve already prepared a script that get all enterprises and then makes a loop for each one and in each ite

HY!

I have a list in GAE, around 300 entries and I would like to send an email to everyone. I've already prepared a script that get all enterprises and then makes a loop for each one and in each iteration it sends an email. Now im concerned with timeout. If I do all the thing in one step, it might take too much time and then i dont know to who i sent or not.

My script is like this:

from models.开发者_JAVA技巧Enterprise import Enterprise
from google.appengine.api import mail

esq = Enterprise.all()
es = esq.fetch(1000) # normally around 300

for e in es:
   mail.send_mail(sender="myemail", to=str(e.email), subject="...")


I suggest you to delegate this task to a taskqueue that provides a fairly high timeout set to 10 minutes.

0

精彩评论

暂无评论...
验证码 换一张
取 消