Monday, 20 January 2020

Email send in Codeigniter

$from_email = "domin.help24@gmail.com";
        //$to_email = $this->input->post('email');
        $to_email = 'in.mukeshsaini@gmail.com';

        $subject = "All Free : Product Enquiry";

$message = "<h1>All Free : Enquiry</h1>";
$message .= "<b>Product : ".$this->input->post('code')."</b><br/>";
$message .= "<b>Name : ".$this->input->post('name')."</b><br/>";
$message .= "<b>Email : ".$this->input->post('email')."</b><br/>";
$message .= "<b>Phone: ".$this->input->post('phone')."</b><br/>";
$message .= "<b>Country: ".$this->input->post('country')."</b><br/>";
$message .= "<b>Description : </b><br/>";
$message .= "".$this->input->post('description')."";

$header = "From:".$this->input->post('email')." \r\n";
$header1 = "MIME-Version: 1.0\r\n";
$header2 = "Content-type: text/html\r\n";

        //Load email library
        $this->load->library('email');
        $this->email->from($from_email, 'Identification');
        $this->email->to($to_email);
        $this->email->cc('domin.help24@gmail.com');


        $this->email->subject($subject);
        $this->email->message($message);
       

        $this->email->set_header('MIME-Version', '1.0; charset=utf-8');
        $this->email->set_header('Content-type', 'text/html');


        //Send mail
        if($this->email->send()){
            $this->session->set_flashdata("email_sent","Congragulation Email Send Successfully.");
        }
        else{
            $this->session->set_flashdata("email_sent","You have encountered an error");
        }

No comments: