-1
                public function  booking() {
                        $this->load->helper(array('form'));
                        $this->load->library(array('session','email'));
                        $this->load->helper('string');
                        //$nwdb['wen_memid']        = $wen_memid         
      ='W'.random_string('alnum',3).'E'.random_string('alnum',3).'N';
                     $name      = $this->input->post('name');
                     $phone     = $this->input->post('phone');
                     $email         = $this->input->post('email');
                     $date  = $this->input->post('date');
                     $message   = $this->input->post('message');
                    

                        $config['protocol'] = 'sendmail';
                        $config['mailpath'] = '/usr/sbin/sendmail';
                        $config['charset'] = 'iso-8859-1';
                        $config['wordwrap'] = TRUE;
                        $config['mailtype'] = 'html';

                        $this->email->initialize($config);
                        $this->email->from('mail@gmail.com');
                        $this->email->to('mail@gmail.com');
                    
                        $this->email->subject('Appoinment Booking');
                        $this->email->message('<html>
                            <head>
                            </head>
                            <body>
                                    <H2>Contact Us</H2><br>
                                    <table rules="all" style="border:1px solid #7fb341;" 
    cellpadding="0">
                                    <tr style="background:#cddfb7;">
                                    <td> <strong>Name: </strong></td><td> '.$name.'</td></tr>
                                    <tr style="background:#cddfb7;">
                                    <td> <strong> Phone: </strong></td><td> '.$phone.'</td></tr>
                                    <td> <strong> Email: </strong></td><td> '.$email.'</td></tr>
                                    <tr style="background:#cddfb7;"><td><strong>Date :</strong></td> 
  <td>'.$date.'</td></tr>
                                    <tr style="background:#cddfb7;"><td><strong>Message:</strong> 
  </td><td>'.$message.'</td></tr>
                                    </table><br><br></body>

                            </html>
                            '); 
                            
                            
                        if ($this->email->send())
                        {
                            redirect('/welcome/bookonline');
                        }
                        else
                        {
                            //error
                            $this->session->set_flashdata('msg','<div class="alert alert-danger text- 
   center">There is error in sending mail! Please try again later</div>');
                            redirect('/');
                        }
                            
                    }

The above is my controller welcome code. welcome/booking is controller name. The form contain "name, email, date, contact number and message" section on it. i want to get the mail to the inbox section.i dont use smtp for this. But here, Every mail is sending to the spam mail. please help me as soon as possible.

Amal
  • 19
  • 3

1 Answers1

0

I have same problem too The solution is make email not suspicious, or using some third party email like SendGrid etc, or setup your own mail server by domain or using your own mail server