我有一个smtp电子邮件配置,通过Codeigniter发送电子邮件,如下所示:
$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);
如果我只发送几封电子邮件,它总是有效的。但是,当我发送大量电子邮件时,会出现如下错误:
Fatal error: Maximum execution time of 30 seconds exceeded in C:\XAMPP\htdocs\sicuti\system\libraries\Email.php on line 2268
通过将值“max_execution_time”中的“php.ini”编辑为9999来解决错误。但是codeigniter会显示如下所示的新问题:
fwrite(): SSL operation failed with code 1. OpenSSL Error messages: error:140D00CF:SSL routines:SSL_write:protocol is shutdown
即使我的smtp配置正确,根据我的cpanel中的建议
如果只有少数电子邮件肯定会有效,但如果出现超过10个错误,我应该更改哪些内容以便我可以一次发送多封电子邮件?谢谢,任何我感谢的回复。
我有一个循环函数来发送多个电子邮件,这会导致错误,因为我一次发送大量的电子邮件,所以我给每个电子邮件传递重定向,以便交付正常。我已经插入了以下循环函数重定向函数,它运行得很好:
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();
}