debugging rsvp-submit.php

This commit is contained in:
spetznas committed 2026-06-17 19:16:12 +02:00
1 parent 891ffce73e
commit 2f1de8f764
11 files changed
+61 -59

No files matched your search

+8 -7
View File
@@ -1,6 +1,5 @@
<?php
require __DIR__ . '/vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
@@ -10,7 +9,6 @@ use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(__DIR__ . '/../');
$dotenv->safeLoad();
function checkboxArrayToString($value)
{
if (is_array($value) && count($value) > 0) {
@@ -39,8 +37,8 @@ $first_name = trim($_POST['first_name'] ?? '');
$last_name = trim($_POST['last_name'] ?? '');
$name = trim("$first_name $last_name");
$email = trim($_POST['email'] ?? '');
$phone = trim($_POST['phone'] ?? '');
$email = trim($_POST['email'] ?? '');
$phone = trim($_POST['phone'] ?? '');
// Attendance
$attendance = $_POST['attendance'] ?? 'Unknown';
@@ -107,12 +105,13 @@ try {
$mail->CharSet = 'UTF-8';
$mail->isSMTP();
$mail->Host = gethostbyname($_ENV['SMTP_HOST']);
$mail->Host = $_ENV['SMTP_HOST'];
$mail->SMTPAuth = true;
$mail->Username = $_ENV['SMTP_USER'];
$mail->Password = $_ENV['SMTP_PASS'];
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = (int)$_ENV['SMTP_PORT'];
$mail->Timeout = 10;
$mail->setFrom($_ENV['FROM_EMAIL'], $_ENV['FROM_NAME']);
$mail->addAddress($_ENV['TO_EMAIL']);
@@ -196,7 +195,6 @@ EOD;
$mail->Body = $body;
$mail->Timeout = 10;
$mail->send();
header('Location: /thank-you/');
@@ -204,5 +202,8 @@ $mail->Timeout = 10;
} catch (Exception $e) {
echo "RSVP could not be sent. Mailer Error: {$mail->ErrorInfo}";
error_log('RSVP mail error: ' . $mail->ErrorInfo);
http_response_code(500);
echo 'An error occurred while sending the RSVP.';
}