0
   $query = $this->db->insert('table_name',$data);
   if($query==true)
   {
      $to = $this->input->post('email');
      $subject = "Activation Link";
      $message = "<p>Welcome: ".$this->input->post('email')."</p>
                    <p>Thank you for join InSquareFeet. To activate your account please <a href=".base_url()."thankyou/".$confirm_id."></a></p>";
      $headers = "MIME-Version: 1.0" . "\r\n";
      $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
      $headers .= "From: ayush@gmail.com";
      mail($to,$subject,$message,$headers);
      echo '<p>Thank you for connecting with us. We have sent you an activation link on your email id.</p>';
   }
   else
   {
      echo '<p>Error!</p>';
   }

In this code, I have created a mail function where I insert the form value into the database which is work perfectly but I also want to send the confirmation mail to the candidate which is not working. I don't know why? Where I am doing wrong? Please help me.

Thank You

Mhrishad
  • 246
  • 1
  • 18
Rudra
  • 156
  • 1
  • 4
  • 13

1 Answers1

0

Codeigniter has provided some inbuilt libraries with examples. I think you guys are not even searching anything and just asking questions How to use. Even if you search How to use email in Codeigniter in google you will get many tutorials about codeigniter libraries and its uses.

Here are some examples for your reference.. Instead of using mail() function use inbuilt libraries which allows you to set smtp config.

How to use email function in codeigniter

How to set configuration for email in codeingiter

Sending email with google smtp configuration in codeigniter

another example about setting config in codeigniter email

Bergin
  • 188
  • 3
  • 12