我的应用程序允许用户一次发送许多电子邮件。问题是,如果用户一次选择许多电子邮件,例如4000+。它显示connection time out
。我无法调试问题,我试图增加脚本执行时间,但没有运气。
我需要一个建议或方法来调试它。
我正在使用亚马逊的SES和php框架Codeigniter。
这是控制器中的代码:
function send_email(){
$data = array();
$sub = $this->input->post('subject');
$msg = $this->input->post('message_email');
$msg = str_replace("\r\n", '<br>',$msg);
$msg = str_replace("\r", '<br>',$msg);
$msg = str_replace("\n", '<br>',$msg);
$emails = $this->input->post('email');
$emails = explode(",",$emails);
$message_m = $msg;
$msg_t = '<html><body>';
$msg_t .= $message_m;
$msg_t .= '</body></html>';
$this->load->library('email');
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'email-smtp.us-west-2.amazonaws.com',
'smtp_user' => 'user',
'smtp_pass' => 'pass',
'smtp_port' => 25,
'mailtype' => 'html'
);
foreach ($emails as $em) {
$this->email->initialize($config);
$this->email->from('something@somewhere.com', 'Somename');
$this->email->to($em);
$this->email->subject($sub);
$this->email->message($msg_t);
$this->email->set_newline("\r\n");
$this->email->send();
}
$this->index();
}