www.webdeveloper.com
Results 1 to 2 of 2

Thread: PHP Mass Email

Hybrid View

  1. #1
    Join Date
    Sep 2013
    Posts
    9

    PHP Mass Email

    Hello. My site has about 15k registered users and I want to send mass mail to all who were inactive for more than a week.
    I know how to check if they were online for more than a week, but the problem is how I'm going to send 15k emails without the server to crash?
    How I can do it smart without wasting too much resources for 15k emails (that some of them are fake)

    I need it for one time (sent to all inactive members one time)

  2. #2
    Join Date
    Oct 2013
    Posts
    3
    This may or may not help you:

    A cron job would probably be the best option for you, run say once a day to check for users that had been inactive for 7 days.

    On my site, which doesn't have so many users, I use the following to send mass mails to members where the mass mail is a custom message (through a form):
    date_default_timezone_set('Europe/London');
    $body = mysql_escape_string($formValue['message']);
    $subject = mysql_escape_string($formValue['subject']);
    $from = 'email@address.com';

    $Query = "SELECT * FROM userdetailstable";
    $Result = mysql_query ($Query, $Link);
    $Rows=mysql_num_rows($Result);
    $loop=0;
    while($loop<$Rows){
    $to=mysql_result($Result,$loop,"EmailAddress");
    mail ($to, $subject, $body, $from);
    $loop++;
    }
    This obviously loops through the users table finding the criteria specified and therefore probably does use up a lot of resources....but at the moment I don't know of any other ways of doing it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles