/home/hdwebsolution/www/app/Views/front/include/contact_form.php
<?php

$uri = service('uri');

$currentpage=$uri->getSegment(1);

?>

<?php
if(isset($_POST['sub123'])){
    $name=$_POST['name'];
    $email=$_POST['email'];
    $mobile=$_POST['number'];
    $reason1=$_POST['reason'];
    $message1=$_POST['message'];
    
    
require_once("PHPMailer/class.phpmailer.php");
$mail = new PHPMailer();
        $mail->IsSMTP(); // we are going to use SMTP
        $mail->SMTPAuth   = true; // enabled SMTP authentication
        $mail->SMTPSecure = "ssl";  // prefix for secure protocol to connect to the server
        $mail->Host       = "smtp.gmail.com";      // setting GMail as our SMTP server
        $mail->Port       = 465;                   // SMTP port to connect to GMail
        $mail->Username   = "amrendrakumar5533@gmail.com";  // user email address
        $mail->Password   = "ymirhvpfqyzrlwem";            // password in GMail
        $mail->SetFrom('amrendrakumar5533@gmail.com','Enquiry For multispecialitydentalcare');  //Who is sending the email
        $mail->AddReplyTo($email,"Enquiry For multispecialitydentalcare");  //email address that receives the response
        $mail->Subject    = "Enquiry For multispecialitydentalcare";
       
        $html = '<p> Name is :'.$name.' </p>';
        $html .= '<p> Email is :'.$email.' </p>';
        $html .= '<p> Mobile is :'.$mobile.' </p>';
        $html .= '<p> Subject is :'.$reason1.' </p>';
        $html .= '<p> Message is :'.$message1.' </p>';
        $mail->Body      = $html;

        $mail->AltBody    = "User Enquiry";
       
         $from = $site_email;
         $url=base_url('thankyou');
        $mail->AddAddress($from, "User Enquiry");
        //$mail->AddCC("amrendrakumar5533@gmail.com");
        if(!$mail->Send()) {
             $success = "Error: " . $mail->ErrorInfo;
        } else {
            $success='<p style="color:green">Your enquiry has been submitted successfully. Our team will get back to you shortly.</p>';
            
        }
    
}

?>
<section class="contact-page-section">
            <div class="auto-container">
                <div class="row">
                    <div class="form-column col-lg-12 col-md-12 col-sm-12">
                        <div class="inner-column">
                            <div class="sec-title text-center">
                                <h6 class="subtitle">Now Very Easy</h6>
                                <h2>Don’t hasitate to contact <br /> with us now</h2>
                            </div>
                            <div class="contact-form">
                                <form method="post" action=""
                                    id="contact-form">
                                    <div class="row">
                                        <div class="form-group col-lg-6 col-md-12 col-sm-12"> <input type="text"
                                                name="username" placeholder="Name" required=""></div>
                                        <div class="form-group col-lg-6 col-md-12 col-sm-12"> <input type="text"
                                                name="phone" placeholder="Phone" required=""></div>
                                        <div class="form-group col-lg-6 col-md-12 col-sm-12"> <input type="text"
                                                name="company" placeholder="Company"></div>
                                        <div class="form-group col-lg-6 col-md-12 col-sm-12"> <input type="email"
                                                name="email" placeholder="Email" required=""></div>
                                        <div class="form-group col-lg-12 col-md-12 col-sm-12"><textarea name="message"
                                                placeholder="Massage"></textarea></div>
                                        <div class="form-group col-lg-12 col-md-12 col-sm-12 text"> <button
                                                class="theme-btn btn-style-one" type="submit" name="submit-form"><span
                                                    class="txt">Submit</span></button></div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                
                </div>
            </div>
        </section>