I am having this issue
My php code is
<?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\SMTP;
use PHPMailer\PHPMailer\Exception;
if(isset($_POST['submit']))
{
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
//Load Composer's autoloader
require 'PHPMailer/Exception.php';
require 'PHPMailer/PHPMailer.php';
require 'PHPMailer/SMTP.php';
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = '000000000000';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
$mail->setFrom('[email protected]', 'Contactform');
$mail->addAddress('[email protected]', 'website mail');
$mail->isHTML(true);
$mail->Subject = "Sender Subject - $subject";
$mail->Body = "Sender Name - $name <br> Sender Email - $email <br> Sender Subject - $subject <br> Message - $message";
$mail->send();
echo "Your message has been sent. Thank you!";
} catch (Exception $e) {
echo "Message could not be sent.";
}
}
?>
And My HTML Contact Form Code is
<div class="col-lg-8">
<form action="contact.php" method="post" role="form" class="php-email-form">
<div class="row">
<div class="col-md-6 form-group">
<input type="text" name="name" class="form-control" id="name" placeholder="Your Name" required>
</div>
<div class="col-md-6 form-group mt-3 mt-md-0">
<input type="email" class="form-control" name="email" id="email" placeholder="Your Email" required>
</div>
</div>
<div class="form-group mt-3">
<input type="text" class="form-control" name="subject" id="subject" placeholder="Subject" required>
</div>
<div class="form-group mt-3">
<textarea class="form-control" name="message" placeholder="Message" required></textarea>
</div>
<div class="my-3">
<div class="loading">Loading</div>
<div class="error-message">Message could not be sent.</div>
<div class="sent-message">Your message has been sent. Thank you!</div>
</div>
<div class="text-center"><button type="submit" name="submit" value="submit">Send Message</button></div>
</form>
</div>
The PHPMailer and contact.php file both are working correctly if i remove this code from contact.php

Which connects my html contact form and php file to send email it works correctly i mean It Only send sample email to email id but it is working.
And When add this code to link my HTML Contact form to Contact.php file it gives me this error
Error: Form submission failed and no error message returned from: contact.php
/** * PHP Email Form Validation - v3.6 * URL: https://bootstrapmade.com/php-email-form/ * Author: BootstrapMade.com */ (function () { "use strict";