Tidy email confirms

This commit is contained in:
2025-03-07 20:44:57 +00:00
parent 2b7d3e5d2a
commit 02f1d46493
3 changed files with 46 additions and 20 deletions

View File

@@ -47,28 +47,30 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
function generatePprEmail($entryId) {
global $mailHost, $mailSMTPAuth, $mailUsername, $mailPassword, $mailPort, $baseUrl, $mailFromAddress, $mailFromName;
$token = generateSecureToken($_POST['email'], $entryId);
$secureLink = "https://ppr.swansea-airport.wales/dev/cancelppr.php?op=view&token=" . urlencode($token);
$secureLink = $baseUrl . "/pilotppr.php?op=view&token=" . urlencode($token);
echo $secureLink;
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = 'send.one.com'; // Your SMTP server
$mail->SMTPAuth = true;
$mail->Username = 'noreply@swansea-airport.wales';
$mail->Password = 'SASAGoForward2155';
$mail->Host = $mailHost;
$mail->SMTPAuth = $mailSMTPAuth;
$mail->Username = $mailUsername;
$mail->Password = $mailPassword;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
$mail->Port = $mailPort;
$mail->setFrom('noreply@swansea-airport.wales', 'Swansea Airport');
$mail->setFrom($mailFromAddress, $mailFromName);
$mail->addAddress($_POST['email']);
$mail->isHTML(true);
$mail->Subject = "Edit Your Entry";
$mail->Subject = "PPR Confirmation";
$mail->Body = "
<p>Click the button below to edit your entry securely:</p>
<p>This is to confirm we have received your PPR. To view or cancel your PPR please click the button:</p>
<a href='$secureLink' style='display: inline-block; padding: 10px 20px; color: white; background-color: #007bff; text-decoration: none; border-radius: 5px;'>Edit Entry</a>
";