Welcome Guest, Not a member yet? Register   Sign In
Timeout and newsletter

I need to send an email to 1500 user's email with a php function; because the timeout is limites to 30" how to do this?
I think to create a page for send 100 email and recall it while i have send all the email....
This is the best solution? or an bcc send is better?
Thank you

OK, you should be able to send up to 100 Emails in only a single call to the Email class. So you should only need to call $this->email->send() 3 times.

You can pass over up to 100 Email addresses in one go, by separating them with a space or a comma:
$email_addresses = "[email protected], [email protected], [email protected]";

You can then do this:
$another_100_email_addresses = getAddresses(2); // This is a fake pager function that doesn't actually exist.

Oh, and yes, use BCC if you don't want the recipients to be copied in on everyone else's addresses.
And repeat as necessary. I'd recommend you make a function that grabs 100 Email addresses for you, and concatenates them into a comma separated string.

You may also wish to raise the maximum execution time limit.
ini_set('max_execution_time', $number_of_seconds);

Hope this helps.

Here's a hypothetical controller, which should send the Emails. Obviously, your database would probably have a different schema, and you wouldn't want to call this function via a URI without some other countermeasures to prevent it being called by just anyone. It hasn't been tested, but in theory it should work or at least help point you in the direction that I would take.
class Emailer extends Controller {
    function Emailer()
    function _get_100_addresses()
        static $start_id = 0;
        $this->db->select('id', 'email_address');
        $this->db->where('id >', $start_id);
        $this->db->order_by('id', 'asc');

        $res = $this->db->get();
        if ($res->num_rows() > 0)
            $arr = array();
            foreach ($res->result_array() as $row)
                $arr[] = $row['email_address'];
                $start_id = $row['id'];
            return implode(',', $arr);
        return FALSE;
    function send_emails()

        $this->email->from('[email protected]', 'Your Name');
        $this->email->subject('Email Test');
        $this->email->message('Testing the email class.');    

        while ($addresses = $this->_get_100_addresses())

Theme © iAndrew 2016 - Forum software by © MyBB