1

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?

Suneel Kumar
  • 1,650
  • 2
  • 21
  • 31
  • I'm voting to close this question as off-topic because because it has nothing to do with PHP or Laravel and everything with email delivery and as such is not a programming question. – marekful Sep 19 '17 at 06:05
  • Mail going into spam mostly depends on provider, does not depend on coding. In case ur IP is not blacklisted. You can setup a free transactional mail account in mailgun/sendgrid smtp providers and use that in codeigniter. – BSB Sep 19 '17 at 06:06

0 Answers0