我有一个控制器功能,称为验证字段,如果验证成功,我将尝试发送电子邮件。我确实收到验证错误,但无法发送邮件。
这是从视图中调用的我的验证函数。我是Codeigniter的新手。
NotReadyAddresses
这是发送邮件功能
public function validation(){
$response=array();
$this->load->library('form_validation');
/*validation Rules*/
$this->form_validation->set_rules('name','name','trim|required');
$this->form_validation->set_rules('phone','phone','trim|required');
$this->form_validation->set_rules('email','email','trim|required|valid_email');
$this->form_validation->set_rules('message','message','trim|required|min_length[10]|max_length[300]');
if($this->form_validation->run()== FALSE){
$response=array('status'=>'danger',
'data'=>validation_errors('<div class="error">','</div>'));
echo json_encode($response);
return false;
}
else{
$emailsend=$this->sendmail($name,$phone,$email,$message);
}
}