<<?php

$message_success ='';
if(isset($_POST['submit'])){
 $type='call';
$name= $_POST['firstname'];
$phone= $_POST['phone'];
$query_about= $_POST['query_about'];
$query_subject= str_replace('-',' ',$_POST['query_subject']);
$query_subject= str_replace('/',' ',$query_subject);
$query_subject= stripslashes($query_subject);
$email= $_POST['email'];
$city= $_POST['city'];
$message_text= $_POST['message_text'];

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

// Load Composer's autoloader
require 'vendor/autoload.php';
  $mail = new PHPMailer\PHPMailer\PHPMailer();
$mail_subject ='SCHEDULE A CALL '.$query_subject;
$from_email ="support@procapitusbusinesspark.com";
$to_email = 'info@procapitusbusinesspark.com';

 //Server settings
   $mail->Host       = 'ssl://mail.dhsconsultant.com'; 
    $mail->SMTPAuth   = true;                       
    $mail->Username   = 'emailer@dhsconsultant.com'; 
    $mail->Password   = 'Email@1234';            
    //$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;  
    $mail->Port       = 465; 


  $mail->AddAddress($to_email, 'Procapitus');
  $mail->SetFrom($from_email, 'Procapitus');
  $message_template= "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>Dear Support team,</p>
<p>Please check the following detail. <strong>SCHEDULE A CALL</strong> submitted by user. </p>
<table>
<tr> <td><strong>Name</strong></td> <td>".$name."</td> </tr>
<tr> <td><strong>Phone</strong></td> <td>".$phone."</td> </tr>
<tr> <td><strong>Message</strong></td> <td>".$message_text."</td> </tr>
</table>
<p>Thanks/Regards</p>
<p>Procapitus</p>

</body>
</html>
";



    $mail->isHTML(true);                                  // Set email format to HTML

    $mail->Subject = $mail_subject;

    $mail->Body    = $message_template;

    $mail->AltBody = '';













  if($mail->Send()){

  //echo  $_SESSION['message_success']= "<strong style='color:green;'>Mail Sent Successfully.</strong>";

  //header('location: thankyou.php');

    echo "<script>window.location.href='https://procapitusbusinesspark.com/thankyou/?type=".$type."';</script>";
die;


  }else{

   echo $_SESSION['message_success']= "<strong style='color:red;'>Mail Sent error...</strong>";

  }

die;




}



?>