def send( self ):
        c = Context({ "content": self.introductory_text, "user":None, 
"request":None, "updates": [] })#Section.updates.all()[:20] })
        t = loader.get_template('emailer/html/updates.html')
        subject = self.subject
        recipients = []
        if self.to_all_principal_contacts:
            self.add_principal_contacts()
        if self.to_all_subscribers:
            self.add_subscribers()
        for i in self.recipients.all():
            recipients.append( i.email )
        self.save()
        html = t.render(c)
        for i in recipients:
            send_html_email( subject, html, "emailataddress.com", i, 
image_root=settings.PROJECT_DIR )
        from datetime import datetime
        self.sent_on = datetime.now()
        self.sent = True
        self.save()

What I want to do is break recipients[] into chunks of say 100 and then 
send_html_email on each email address within each chunk for all chunks BUT 
I want to preserve the self.sent = True self.save() to be done after all 
chunks have been sent.
I think it may also need some method of timebreak between each chunk being 
processed.
This is come about because the server/host seems to have a problem with 
sending 1500 emails in one go.  The above sends to small numbers but not 
all in one go.

Thanks for helping





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fc804755-1bc1-43f0-a15f-a98984be04fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to