Welcome Guest, Not a member yet? Register   Sign In
How to send email for more than 1000 user............
#16

[eluser]Derek Allard[/eluser]
I have a story that's relevant here. I started with a 50 person mailing list for a client. I wrote the code and it is almost exactly as you'll see it below. Then that list ballooned to 450+. Ouch! Didn't see that coming, and didn't do proper research into how to send to THAT many people. Regardless, the code has more or less held up.

Here's how I've implemented this. First, the ground-rules from the client...

1) HTML email
2) Each subscriber needs to be the "to". No bcc bulk sending
3) They hosted on a moderate host. Not "high end", but not a low end budget host
4) Emails get sent once per day, and each has a unique issue number (essentially the id in the db)

I set it up nearly identically to how Michael proposes. Here's a large chunk of code.
Code:
foreach ($list->result() as $address) {
    $this->email->clear();
    $this->email->to($address->email);
    $this->email->from($this->config->item('admin_email'), 'Name');
    $this->email->subject('Newsletter for ' . date ("F jS, Y"));
    $this->email->message($this->load->view('newsletter/daily_newsletter', $data, true));
    $email_sent = $this->email->send();

// this is assigned to a var rather then just
// if ($this->email->send()) because I needed to manually
// toggle that back and forth, and it just seemed easier

    if ($email_sent) {
        $this->user_model->update_sent_issue($address->email, $issueNumber);
        $output .= '<li>' . $address->email . '</li>';
    } else {
        $output .= '<li><strong style="color:#C00;">Could not send to ' . $address->email . '</strong></li>';
    }
}

The $list variable is a model call, that is limited to 100 emails. You'll see after each email is sent, it goes in and updates the db to indicate what the last "issue" they rec'd was. The server handles 100 no problem, but it would be trivial to limit that to 75, or 50, or 10 if I needed to.

After it sends to 100 people, the admin gets a list (the $output var) of who was sent to, (and not sent to), and they are prompted to re-run the page again, where it'll grab the next 100 people.

I could have automated the page reloading via a sleep() and a redirect() I guess, but the way it is running now seems to work for them.


Messages In This Thread
How to send email for more than 1000 user............ - by El Forum - 10-09-2007, 07:18 AM
How to send email for more than 1000 user............ - by El Forum - 10-09-2007, 07:28 AM
How to send email for more than 1000 user............ - by El Forum - 10-09-2007, 09:20 AM
How to send email for more than 1000 user............ - by El Forum - 10-09-2007, 09:29 AM
How to send email for more than 1000 user............ - by El Forum - 10-09-2007, 09:32 AM
How to send email for more than 1000 user............ - by El Forum - 10-09-2007, 10:54 PM
How to send email for more than 1000 user............ - by El Forum - 10-09-2007, 11:03 PM
How to send email for more than 1000 user............ - by El Forum - 10-09-2007, 11:38 PM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 12:10 AM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 01:17 AM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 01:39 AM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 01:55 AM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 01:58 AM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 02:12 AM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 05:22 AM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 06:48 AM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 07:12 AM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 01:22 PM
How to send email for more than 1000 user............ - by El Forum - 10-10-2007, 06:38 PM
How to send email for more than 1000 user............ - by El Forum - 10-11-2007, 08:30 AM
How to send email for more than 1000 user............ - by El Forum - 02-05-2008, 11:21 AM
How to send email for more than 1000 user............ - by El Forum - 03-01-2009, 03:57 PM
How to send email for more than 1000 user............ - by El Forum - 11-26-2009, 12:34 AM
How to send email for more than 1000 user............ - by El Forum - 11-26-2009, 01:19 AM
How to send email for more than 1000 user............ - by El Forum - 11-26-2009, 06:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB