File: C:/laragon/www/its/sendApplication.php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'Exception.php';
require 'PHPMailer.php';
require 'SMTP.php';
$rawData = file_get_contents("php://input");
$data = json_decode($rawData, true);
$firstname = $data['firstname'];
$lastname = $_data['lastname'];
$typeJob = $data['typeJob'];
$email = $data['email'];
$phone = $data['phone'];
$message = $data['message'];
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "smtp.office365.com";
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->Port = 587;
$mail->Username = "info@italiantouristservices.uk";
$mail->Password = '$vr9K%VNzc5[;iAi!eL=';
$mail->setFrom('info@italiantouristservices.uk', 'Web Italian Tourist Services LTD');
$mail->addAddress($email);
$mail->addBCC("info@italiantouristservices.uk");
$mail->isHTML(true);
$mail->Subject = 'Job Application Acknowledgment - ' . $typeJob;
$mail->Body = "
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>Job Application Acknowledgment</title>
<style>
body { font-family: Arial, sans-serif; color: #333; }
.container { max-width: 600px; margin: auto; background-color: #f4f4f4; padding: 20px; border-radius: 10px; }
h1 { color: #0056b3; }
ul { list-style-type: none; padding: 0; }
li { margin-bottom: 10px; }
.footer { margin-top: 20px; font-size: 0.9em; text-align: center; color: #888; }
</style>
</head>
<body>
<div class='container'>
<h1>Job Application Acknowledgment</h1>
<p>Dear $firstname $lastname,</p>
<p>Thank you for submitting your job application for the position of <strong>$typeJob</strong> with us. We have received your application and our team will start the review process shortly.</p>
<p>Here is a summary of the information you submitted:</p>
<ul>
<li>Email: $email</li>
<li>Phone: $phone</li>
<li>Message: $message</li>
</ul>
<p>We appreciate your interest in joining our team and will get back to you as soon as possible with the next steps.</p>
<p class='footer'>Best regards,</p>
<p class='footer'>Italian Tourist Services LTD</p>
</div>
</body>
</html>";
$mail->send();
$result = array(
'message' => 'Success, email sent!',
);
echo json_encode($result);
} catch (Exception $e) {
$result = array(
'message' => 'Failed to send email! ' . $e->getMessage(),
);
echo json_encode($result);
}
?>