<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'src/Exception.php';
require 'src/PHPMailer.php';
require 'src/SMTP.php';

include("job_mail.php");



// Load Composer's autoloader


// Instantiation and passing `true` enables exceptions
$mail = new PHPMailer(true);

try {
    //Server settings
    $mail->SMTPDebug = 2;                                       // Enable verbose debug output
    $mail->isSMTP();                                            // Set mailer to use SMTP
    $mail->Host       = 'mail.weddingdiarybooking.com';  // Specify main and backup SMTP servers
    $mail->SMTPAuth   = true;                                   // Enable SMTP authentication
    $mail->Username   = 'crm@weddingdiarybooking.com';                     // SMTP username
    $mail->Password   = 'N*H$]6BPFFCx';                                                             // SMTP password
    $mail->SMTPSecure = 'ssl';                                  // Enable TLS encryption, `ssl` also accepted
    $mail->Port       = 465;                                    // TCP port to connect to

    //Recipients
    $mail->setFrom('crm@weddingdiarybooking.com', 'WD CRM');
    $mail->addAddress('wdcrmbackup@gmail.com', 'z');     // Add a recipient
//    $mail->addAddress('zahid230@gmail.com', 'j');     // Add a recipient
    $mail->addAddress('sajibpaul.com@gmail.com', 'j');     // Add a recipient
    
    
    // Attachments
    $mail->addAttachment($FileName_as);         // Add attachments
	$mail->addAttachment($FileName_ev);         // Add attachments
	$mail->addAttachment($FileName_bk);  
    $mail->addAttachment($FileName_py);  
	$mail->addAttachment('db_backup/db-backup-'.date("Ymd", time()).'.sql.gz'); 
	
	
    // Content
    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = 'Email Backups - WD CRM';
    $mail->Body    = 'Attached your necessary data in  <b>CSV format!</b>';
    $mail->AltBody = 'Attached Contents your necessary data in CSV format!';

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

?>