<?php

$response ="";
if(isset($_POST['submit']))
{
    require '../includes/phpMailer/PHPMailer.php';
	require '../includes/phpMailer/PHPMailerAutoload.php';
    require_once '../includes/phpMailer/SMTP.php';
    require_once '../includes/phpMailer/Exception.php';

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

	$mail = new PHPMailer;


	//SMTP Settings
    $mail->isSMTP();
	$mail->Host = 'localhost.@oscotechesaoke.edu.ng';
	$mail->Port = 25;
	$mail->SMTPAuth= false;
	$mail->SMTPSecure='tls';
	$mail->SMTPAutoTLS =false;
	$mail->Username = 'noreply@oscotechesaoke.edu.ng';
// 	$mail->Password = '.............';

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

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

	
}


?>