<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

//Load Composer's autoloader
require 'vendor/autoload.php';

if(isset($_POST['informed_update'])){
   
    $customer_informed = trim($_POST['informed']);
    // echo $fullName;
    // die();
   

if($customer_informed){
    
    
    //Create an instance; passing `true` enables exceptions
    $mail = new PHPMailer(true);
    
    try {
        //Server settings
        //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
     //   $mail->SMTPDebug = 2;	
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'cpanel.hrctech.net';                     //Set the SMTP server to send through
      //  $mail->Host       = 'https://mail.fsiblbd.com';                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'website@fsiblbd.com';                     //SMTP username
        $mail->Password   = 'xZ(Ns{km0Aar';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;            //Enable implicit TLS encryption
        $mail->Port       = 587;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
      //  $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
    
        //Recipients
        $mail->setFrom('website@fsiblbd.com', 'Website');
      //  $mail->addAddress('joe@example.net', 'Joe User');     //Add a recipient
        //$mail->addAddress('website@fsiblbd.com');               //Changed from cscmc.fsibl@gmail.com
        $mail->addAddress('ryhankazi@gmail.com'); 
        //Content
        $mail->isHTML(true);                                  //Set email format to HTML
        $mail->Subject = 'FSIB Complaint Submission Form';
       $mail->Body    = 'Muhtaram/Muhtarama,<br>Assalamu-alaikum,<br><br> Informed : <b>'.$customer_informed;
       // $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
    //    $mail->Body    = 'Muhtaram/Muhtarama,<br>Assalamu-alaikum,<br><br> Full name';
        $mail->send(); //Sending too many emails
        //echo 'Message has been sent';
        echo '<script type="text/javascript"> var show_text = confirm("SUCCESSFULLY MAIL SENT")
        window.location.href = "#";
        </script>';
        

    } catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
    }
}
}
?>