[Zope] sending thousands of emails in the background (returning the webpage immediately) ? webpage immediately) ?

chas panda@skinnyhippo.com
Thu, 23 Nov 2000 03:00:19 +0800


Going back about 10 months to a problem I had before.

Goal: an end-user fills in a form on a webpage and clicks
      the 'submit' button.  As a result, thousands of 
      customized e-mail messages are sent.

Problems: 
(i)   The msgs are customized so Mailman is not appropriate.
      also, there is substantial workflow so Zope is preferred.
(ii)  The end user only uses a web browser - s/he will not be
      expected to log in and use ZClient, so the previous solution
      suggested below is not viable.
(iii) The confirmation webpage must return immediately... 
      ie. we do not want to wait for all the emails to be 
      sent before the page is returned to the user.
      This has to be processed in the background (perhaps
      for the next hour or so, even if the user logs off).

      Possible scenario : user logs on, fills in form, hits 'submit', 
      confirmation webpage is returned to the user saying it's ok,
      emails start to get sent out, user logs off, emails
      continue to get sent out, user logs back on 2 hrs later
      and its still processing.


Anyone any ideas on this one ? Thanks a lot,

cheers,

chas


>>>> chas wrote
>> Zope's dtml-sendmail tag is excellent - it makes sending
>> e-mail a breeze. It reminds me of a similar tag that
>> Cold Fusion added and which I've noticed many sites use
>> for sending out customized newsletters (the "Allaire 
>> ColdFusion Application Server" header being the giveaway).
>> 
>> Now, doing the same in Zope, I can loop over the user 
>> profiles in our database to extract name, e-mail, and
>> even customize the content of the newsletter as follows :
>> 
>> 
>> <dtml-in ZSQL_Select_User_Profiles>
>> 
>> <!--#sendmail mailhost="ZMailHost"--> 
>> To: <dtml-var firstname> <<dtml-var email>> 
>> From: robot <robot@ourdomain.com> 
>> Subject: <dtml-var random_inanity>
>> 
>> Dear <dtml-var firstname>,
>> 
>> blah blah content (also dependent on his/her likes/preferences)
>> 
>> <!--#/sendmail--> 
>> 
>> </dtml-in>
>> 
>> 
>> Nothing groundbreaking so far. But the question then is : how
>> is this going to work if the user database numbers 200,000+ ?
>> It will take almost half a day to complete and this can't be
>> done in one form-submission or page load !
>
>
>Why not use ZClient to make the request to do the mailout?
>It can just happily sit there for half a day (or whatever) chugging
>along, without screwing up if your browser goes away.
>
>Anthony