File "informCustomer.php"

Full path: /home/fsibplc/public_html/admin/remittance/informCustomer.php
File size: 3.19 B (3.19 KB bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

include 'dbconnect.php';

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

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


    
if(isset($_POST['inform_customer_btn'])){
     $id = $_POST['id'];
   
    $customer_informed = $_POST['cust_informed'];
    // echo $fullName;
    // die();
   $update_sql = "UPDATE account_info SET inform = '$customer_informed' WHERE id=$id";
   $informToCustomer = $conn->query($update_sql);
   
   
   $sql = "SELECT * FROM `account_info` WHERE id=$id";
   $execute = $conn -> query($sql);
   $clientInfo = $execute -> fetch_assoc();
   $clientEmail = $clientInfo["email"];
   
   

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($clientEmail); 
        //Content
        $mail->isHTML(true);                                  //Set email format to HTML
        $mail->Subject = 'FSIB Account Opening Request';
       $mail->Body    = 'Muhtaram/Muhtarama,<br>Assalamu-alaikum,<br>Account Number: '.$clientInfo['ac_number'].'<br>';
       // $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 = "https://fsibplc.com/remittance/dashboard.php";
        </script>';
        

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