AndyB
Well-known member
In my add-on Inactive Members:
http://xenforo.com/community/threads/inactive-members.69518/
I use the following code to send emails:
It was reported to me that after about 5,000 emails being sent, the browser hangs with an error, sorry the error was not given.
My question, is there a way I can avoid the browser hanging by adding some code to throttle the emails?
Thank you.
http://xenforo.com/community/threads/inactive-members.69518/
I use the following code to send emails:
PHP:
foreach ($emails as $k => $v)
{
// prepare $to variable
$to = $v['email'];
// replace {username} in message
$nextMessage = str_replace('{username}', $v['username'], $message);
// username
$username = $v['username'];
// email
$email = $v['email'];
// define user variable
$user = array(
'username' => $username,
'email' => $email
);
// prepare mailParams
$mailParams = array(
'user' => $user,
'subject' => $subject,
'message' => $nextMessage
);
// prepare mail variable
$mail = XenForo_Mail::create('inactivemembers_contact', $mailParams);
// send mail
$mail->queue($user['email'], $user['username']);
}
It was reported to me that after about 5,000 emails being sent, the browser hangs with an error, sorry the error was not given.
My question, is there a way I can avoid the browser hanging by adding some code to throttle the emails?
Thank you.