SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Nov 2003
    Location
    Brisbane, Australia
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Email Subscription Tool

    Hi All

    I have built my own email subscription tool and for small runs of emails; a couple of hundred or less; it all works fine.

    The issue I am having is when a large number of emails are sent the server times out before everything is sent or a client is closing the browser before the send is finished.

    Currently I am just using a WHILE loop and the PHP MAIL function and sending an individual email to each person.

    Does anyone know a way or can make any suggestions on how to can fix this issue?

    Many Thanks

    mrmbarnes

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,032
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    I don't know the details of how you have things set up, but IMHO ideally this would be CRON run and be independant from a "browser closing". So I'm guessing the code is run in a page?

    You could try ignore_user_abort() but be warned, and endless loop condition would wreak havoc.

    For the larger iterations, you could try BCC in batches instead of 1 each loop.

  3. #3
    SitePoint Evangelist
    Join Date
    Nov 2003
    Location
    Brisbane, Australia
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    Thanks for your reply.

    I had thought of running it as a separate file but I think I would have the same issue with the timeouts. Wouldn't I?

    BCC will not really work as I want the option to personalise each email.

    Thinking about it would a FOREACH statement work better than a WHILE statement as far as speed?

    Any other suggestions?

  4. #4
    Web Developer stickycarrots's Avatar
    Join Date
    Jul 2005
    Location
    Illinois State University
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would just run them in batches. Send 100, refresh the page, and send another 100. Also, isn't there a variable you can change in your php.ini about timeouts? Not sure myself...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •