An AJAX HTTP request terminated abnormally I am running a large script using batch api. I am sending newsletter mails to users. Mail sending is in bulk. I mean the mails is going to 8000 users. For testing I sent it to 1000 users and it worked fine. But for 8000 users it showing me this error :

An AJAX HTTP request terminated abnormally. Debugging information follows. Path: /batch?id=34485&amp;op=do StatusText: ResponseText: ReadyState: 4


Or is there any other way to do the same? Following my code :

&lt;?php
function testingmail() {
    $batch = array(
        'title' =&gt; t('Sending Mail...'),
        'operations' =&gt; array(),
        'init_message' =&gt; t('Connecting'),
        'progress_message' =&gt; t('Processed @current out of @total.'),
        'error_message' =&gt; t('An error occurred during processing'),
        'finished' =&gt; 'skeleton_batch_finished',
        'progressive' =&gt; FALSE
    );
    $result = db_select('customsendemail', 'c')-&gt;fields('c')-&gt;execute();
    $userslist = array();
    while($users = $result-&gt;fetchAssoc()) {
        $userslist[] = $users;
    }
    for($i=0;$i&lt;count($userslist);$i++) {
        $userslist[$i]['user'] = explode(",", $userslist[$i]['user']);
    }
    $finallist = array();
    foreach($userslist as $value) {
        foreach($value['user'] as $key =&gt; $value2) {
            $finallist[] = array('mail' =&gt; $value2, 'subject' =&gt; $value['subject'], 'message' =&gt; $value['body']);
        }
    }
    foreach ($finallist as $userdetail) {
        $batch['operations'][] = array('skeleton_batch_worker', array($userdetail)); 
      }
    batch_set($batch);
    batch_process('&lt;front&gt;');
}

function skeleton_batch_worker($userdetail, &amp;$context) {
  if(!isset($context['results']['processed'])) {
    $context['results']['processed'] = 0;
  }
  $context['results']['processed']++;
  $context['message'] = 'Sending Mail to '.$userdetail['mail'].' and subject '.$userdetail['subject'];
  $params['subject'] = $userdetail['subject'];
  $params['body'] = $userdetail['message'];
  drupal_mail('custom', 'mynewsletter', $userdetail['mail'], language_default(), $params, 'my@email.com', TRUE);
}

function skeleton_batch_finished($success, $results, $operations) {
  if ($success) {
    db_delete('customsendemail')-&gt;execute();
    $message = format_plural($results['processed'], 'One email sent.', '@count email sent.');
    variable_del("customnewsletter");
    watchdog("Custom Newsletter", "Custom Newsletter end.");
  }
  else {
    $message = 'Somer error in newsletter sending.';
    variable_del("customnewsletter");
    drupal_mail('custom', 'mynewsletter', 'my@email.com', language_default(), array('subject'=&gt;'error in newsletter sending', 'message'=&gt;'sending error'), 'my@email.com', TRUE);
  }
  drupal_set_message($message);
}
I have setup a cron job that sending mail to 500 users in every half hour.