【发布时间】:2021-06-19 13:11:59
【问题描述】:
想处理发送邮件时 smtp 主机服务器重启的情况。发送脚本的电子邮件不应因运行时错误而终止。它应该尝试重新连接到服务器主机并再次发送电子邮件
我的代码:
$config=array('protocol'=>'smtp',
'smtp_host'=>'example.com',
'smtp_port'=>587,
'smtp_user'=>'******',
'smtp_pass'=>'***',
'priority'=> 1,
'smtp_timeout'=>'30',
//'smtp_keepalive'=>TRUE,
'mailtype' => 'html',
'charset'=>'utf-8',
'wordwrap'=>True);
foreach($res2 as $email)
{
$this->email->from($fromemail,$fromname);
$this->email->to($email);
$this->email->subject('Dummy Email');
$body=$emailDesign2;
$this->email->message($body);
if($this->email->send())
{
echo "Mail Sent<br/>";
$total++;
}
else
{
echo "Mail Not Sent";
}
}
【问题讨论】:
标签: php codeigniter