Below is my php code. I am using gcp app engine first time and it is throwing error PHP Fatal error: require(): Failed opening required 'vendor/phpmailer/phpmailer/src/Exception.php'. I already have this file in the directory mentioned, then also it shows this error. Is it regarding the new phpmailer format or something else? Please help.
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
</head>
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP;
require 'vendor/phpmailer/phpmailer/src/Exception.php';
require 'vendor/phpmailer/phpmailer/src/PHPMailer.php';
require 'vendor/phpmailer/phpmailer/src/SMTP.php';
// Include autoload.php file
require 'vendor/autoload.php';
// Create object of PHPMailer class
$mail = new PHPMailer(true);
$output = '';
if (isset($_POST['submit'])) {
$name = $_POST['contactName'];
$email = $_POST['contactEmail'];
$subject = $_POST['contactSubject'];
$message = $_POST['contactMessage'];
try {
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
// Gmail ID which you want to use as SMTP server
$mail->Username = 'rajeshsingh80906@gmail.com';
// Gmail Password
$mail->Password = 'secret';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
// Email ID from which you want to send the email
$mail->setFrom('rajeshsingh80906@gmail.com');
// Recipient Email ID where you want to receive emails
$mail->addAddress('ranarajesh495@gmail.com');
// $mail->addAttachment('');
$mail->isHTML(true);
$mail->Subject = 'Form Submission';
$mail->Body = "<h3>Name : $name <br>Email : $email <br>Message : $message</h3>";
$mail->send();
$output = '<div class="alert alert-success">
<h5>Thankyou! for contacting us, We\'ll get back to you soon!</h5>
</div>';
} catch (Exception $e) {
$output = '<div class="alert alert-danger">
<h5>' . $e->getMessage() . '</h5>
</div>';
}
}
?>
<title>insert page</title>
<script type="text/javascript">
function back_to_main() {
setTimeout(function () {
//Redirect with JavaScript
window.location = './index.html'
}, 5000);
}
</script>
<body onload='back_to_main();'>
thank you...
</body>
</html>