This code is working fine but mails are going to spam folder instead of inbox.
public function get_in_touch_always(){
$this->_Creating_get_in_touch_always();
if ($this->form_validation->run() === TRUE){
$data = array();
$data['name'] = $_POST['name'];
$data['email'] = $_POST['email'];
$data['phone'] = $_POST['mobile'];
$data['message'] = $_POST['message'];
//$data['charges'] = $_POST['charges'];
$data['upload_date'] = date("d M Y");
$data['upload_time'] = date("h:i a");
if ($this->b->insert_in_touch_always($data)) {
$this->load->library('email');
$config['protocol']='smtp';
$config['smtp_host']='xxx.com';
$config['smtp_port']='465';
$config['smtp_timeout']='60';
$config['smtp_user']='xxx@yy.com';
$config['smtp_pass']='xxx';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['crlf']="\r\n";
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize('email',$config);
$this->email->from('xxx@yy.com', 'xxx');
$this->email->to('yyyy');
$this->email->bcc('zzz@gmail.com');
$this->email->subject('Notification Mail');
$this->email->message('Hie world');
if($this->email->send()){
echo "Sent";
}else{
echo "fail";
}
die();
echo "ok sent";
show_error($this->email->print_debugger());
$this->outputData['error'] = 'Successfully Your Query is Created';
} else {
$this->outputData['error'] = 'Failed To Insert';
}
} else {
$this->outputData['error'] = validation_errors();
}
$this->load->view('thanku', $this->outputData);
}
}
Please let me know the solution for this. I am getting the mails but it is still going to spam folder. Is there anything to be added for this?