Reputation: 107
I have a smtp e-mail configuration to send e-mail via Codeigniter as follows:
$config = [
'protocol' => 'smtp',
'smtp_host' => 'ssl://cph.dnet.net.id',
'smtp_port' => 465,
'smtp_timeout' => 50,
'smtp_user' => '[email protected]',
'smtp_pass' => 'MyPaSsWoRd',
'smtp_keepalive' => 'TRUE',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
];
$this->email->initialize($config);
If I only send a few emails it always works. However, when I send a lot of emails an error occurs like the following:
Fatal error: Maximum execution time of 30 seconds exceeded in C:\XAMPP\htdocs\sicuti\system\libraries\Email.php on line 2268
error is solved by editing "php.ini" in the value "max_execution_time" to 9999 .but codeigniter displays new problems like this:
fwrite(): SSL operation failed with code 1. OpenSSL Error messages: error:140D00CF:SSL routines:SSL_write:protocol is shutdown
even though my smtp configuration is correct, according to the recommendations in my cpanel
If only a few emails will definitely work, but if more than 10 errors will appear, What should I change so that I can send multiple emails at a time? Thank you, any response I appreciate.
Upvotes: 1
Views: 5468
Reputation: 107
I have a loop function to send multiple e-mails, which causes errors because I send a lot of emails at one time, so I give a redirect to every e-mail delivery so that the delivery works normally. The following loop function I have inserted the redirect function, and it works very well :
function index () {
if (!empty($this->Leave_Model->count_all_leave_wait())) {
$leave_wait_data = $this->Leave_Model->get_all_leave_wait();
foreach ($leave_wait_data as $res) {
if (date('Y-m-d')>$res->Confirm_Date) {
$this->Send_Leave_Request($res->L_Request_ID); # Send Email
$this->Leave_Model->update_lvd_confirm_date($res->L_Request_ID); # Update Confirm Date When Success Send
redirect('Login_Employe'); # Redirect
}
}
}
}
function Send_Leave_Request ($id)
{
# bla bla bla
$this->email->message('Bla bla la bla bla...');
$this->email->send();
}
Upvotes: 1