<?php

require_once("includes/initialize.php");
global $database;

 $message_output='';
 



$response ="";
if(isset($_POST['submit']))
{

	$name = $_POST['name'];
    $email = $_POST['email'];
    $subject = $_POST['subject'];
    $msg = $_POST['msg'];

/*	$mail = new PHPMailer;


	//SMTP Settings
    $mail->isSMTP();
// 	$mail->Host = 'mail.oscotechesaoke.edu.ng';
	$mail->Host = 'smtpout.oscotechesaoke.edu.ng';
	$mail->Port = 26 ;
	$mail->SMTPAuth= true;
	$mail->SMTPSecure='ssl';
	$mail->SMTPAutoTLS =false;
	$mail->Username = 'no.reply@oscotechesaoke.edu.ng';
// 	$mail->Password = 'academics_123';

	//Email Settings
    $mail->isHTML(true);
    $mail->setFrom('no.reply@oscotechesaoke.edu.ng', 'Osun State College of Technology, Esa Oke');
    $mail->addAddress("$email");
    $mail->Subject = $subject;
    $mail->Body = $body;
*/

	
	$to = $email;
// 	$subject="OSCOTECH Admission Registration Details!";
	$body=$name.",";
	$body .= PHP_EOL;
	$body .= $msg;
	$body = stripslashes($body);
	$headers = "From: BUSARY CERTIFICATE PROCESSING UNIT@oscotechesaoke.edu.ng";
	$headers .= PHP_EOL;
	$headers .= "Return-Path: no.reply11@oscotechesaoke.edu.ng";
	$headers .= PHP_EOL;
	$headers .= "Reply-To: no.reply90@oscotechesaoke.edu.ng";
	mail($to,$subject,$body,$headers);
	



    if(mail)
    {
        // $status = "success";
       $response = "Email is sent!";
    }else{
        // $status = "failed";
       $response = "Something is wrong: <br>".$mail->ErrorInfo;
    }

	
}


?>

<html lang="en">

<head>
<!--  <meta charset="UTF-8">-->
<!--  <meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<!--  <meta name="viewport" content="width=device-width,initial-scale=1">-->
  <!--<title>Certificate Request Response</title>-->
   <!--<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">-->
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
 
</head>

<!--<body class="bg-dark">-->
<body>
  <div class="container89" >
    <div class="row justify-content-center">
      <div class="col-md-4 mt-5 bg-light rounded">
        <h1 class="text-center font-weight-bold text-primary">OSCOTECH :: MAIL</h1>
        <hr class="bg-light">
        <h5 class="text-center text-success"><?echo $response?></h5>
        <form action="" method="post" id="form-box" class="p-2">
          <div class="form-group input-group">
            <div class="input-group-prepend">
              <span class="input-group-text"><i class="fas fa-user"></i></span>
            </div>
            <input type="text" name="name" class="form-control" value="<?php echo 'Certificate Report From Bursary';?>"placeholder="Certificate Report From Bursary" readonly="readonly" required>
          </div>
          <div class="form-group input-group">
            <div class="input-group-prepend">
              <span class="input-group-text"><i class="fas fa-envelope"></i></span>
            </div>
            <input type="email" name="email" class="form-control" value="<?php echo 'academiccertificate@gmail.com';?>" placeholder="academiccertificate@gmail.com" readonly="readonly" required>
          </div>
          <div class="form-group input-group">
            <div class="input-group-prepend">
              <span class="input-group-text"><i class="fas fa-at"></i></span>
            </div>
            <input type="text" name="subject" class="form-control" value="Certificate Payment Clearance Report" placeholder="Certificate Payment Clearance Report" readonly="readonly" required>
          </div>
          <div class="form-group input-group">
            <div class="input-group-prepend">
              <span class="input-group-text"><i class="fas fa-comment-alt"></i></span>
            </div>
            <textarea name="msg" id="msg" class="form-control"
            placeholder="Write your message" cols="40" rows="6"  required></textarea>
          </div>
          <div class="form-group">
            <input type="submit" name="submit" id="submit" class="btn btn-primary btn-block" value="Send Message">
          </div>
          <div class="form-group">
            <a class="btn btn-primary btn-block" href="dashboard.php"> Back </a>
          </div>
        </form>
        
      </div>
    </div>
  </div>
</body>

</html>