Codeigniter sending multiple messages does not work, why?

Needed to implement the project on the CodeIgniter function to send messages to all registered users. Sending via SMTP works without problems for notification to the 1-2-3 box. But if you want to make a list of 50+ addresses that have errors.

1) Message: fwrite(): SSL: Broken pipe
2) periodically Gateway Time-out

Piece of code:

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.mail.EN';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'username';
$config['smtp_pass'] = '123456789';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";
$config['mailtype'] = 'html';
$config['bcc_batch_mode'] = true;
$config['bcc_batch_size'] = 200;
$config['validate'] = true;

//in the array $results - are 50+ email addresses
//in a loop send a letter to each box
foreach ($results as $key => $result) {
$this->email->clear();
$this->email->initialize($config);
 $this->email->from('info@mysite.com', 'MYNAME');
$this->email->to($result);
 $this->email->subject('Subject');
 $this->email->message('A message here'); 

$this->email->send();
}


Use email on your domain Mail.ru the SPF record is configured
July 4th 19 at 23:06
1 answer
July 4th 19 at 23:08
Very simple, try to add a pause between sendings. You can simply stream cut.

Find more questions by tags CodeIgniterE-mailEmail marketingPHP