Answer the question
In order to leave comments, you need to log in
Codeigniter sending multiple messages doesn't work, why?
It was necessary to implement the function of sending messages to all registered users in the CodeIgniter project. Sending via SMTP works without problems for notifications for 1-2-3 mailboxes. But if you need to send out mailings to 50+ addresses, then errors appear.
1) Message: fwrite(): SSL: Broken pipe
2) Periodically Gateway Time-out
Code piece:
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.mail.ru';
$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;
//в массиве $results - храняться 50+ email адресов
//в цикле отправляем письмо на каждый ящик
foreach ($results as $key => $result) {
$this->email->clear();
$this->email->initialize($config);
$this->email->from('[email protected]', 'MYNAME');
$this->email->to($result);
$this->email->subject('Тема письма');
$this->email->message('А тут сообщение');
$this->email->send();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question