diff --git a/backend/config.php b/backend/config.php deleted file mode 100644 index 2d303c9..0000000 --- a/backend/config.php +++ /dev/null @@ -1,10 +0,0 @@ - 'dev@andre-kempf.com', - 'from_email' => 'noreply@andre-kempf.com', - 'app_name' => 'Portfolio Contact', -]; \ No newline at end of file diff --git a/backend/sendMail.php b/backend/sendMail.php deleted file mode 100644 index 7d46e47..0000000 --- a/backend/sendMail.php +++ /dev/null @@ -1,79 +0,0 @@ -honeypot ?? $params->website_hp ?? $params->website ?? ''; - if (!empty($honeypot)) { - // Silently discard bot submission with 200 OK - http_response_code(200); - echo json_encode(["status" => "success"]); - exit; - } - - // Sanitize & validate incoming fields - $email = filter_var($params->email ?? '', FILTER_VALIDATE_EMAIL); - $name = htmlspecialchars(trim($params->name ?? 'Anonymous'), ENT_QUOTES, 'UTF-8'); - $text = htmlspecialchars(trim($params->message ?? ''), ENT_QUOTES, 'UTF-8'); - - if (!$email || empty($text)) { - http_response_code(400); - echo json_encode(["status" => "error", "message" => "Invalid input data"]); - exit; - } - - // Render HTML email template - $rawMessage = $params->message ?? ''; - $emailBody = renderEmailTemplate($name, $email, $text, $rawMessage); - $subject = "{$config['app_name']}: $name"; - - // Construct standard MIME headers - $headers = [ - 'MIME-Version: 1.0', - 'Content-type: text/html; charset=utf-8', - "From: {$config['from_email']}", - "Reply-To: $email" - ]; - - // Send email via PHP native mailer - $success = mail($config['recipient_email'], $subject, $emailBody, implode("\r\n", $headers)); - - if ($success) { - http_response_code(200); - echo json_encode(["status" => "success"]); - } else { - http_response_code(500); - echo json_encode(["status" => "error", "message" => "Failed to send email"]); - } - break; - - // 3. Reject Unsupported HTTP Methods - default: - header("Allow: POST, OPTIONS", true, 405); - http_response_code(405); - echo json_encode(["status" => "error", "message" => "Method Not Allowed"]); - exit; -} \ No newline at end of file diff --git a/backend/templates/emailTemplate.php b/backend/templates/emailTemplate.php deleted file mode 100644 index c91cc5b..0000000 --- a/backend/templates/emailTemplate.php +++ /dev/null @@ -1,53 +0,0 @@ - -