feat(contact): server-side PHP mail handler for contact form
All checks were successful
Deploy Feature Branch to Test / deploy (push) Successful in 24s

Fix #34: E-Mail-Versand via PHP

- PHP POST handler with server-side validation (name, email, message)
- mail() with From/Reply-To set to form email address
- Recipient: mki@kies-media.de
- Honeypot spam protection (hidden field)
- Minimum submit time check (3 seconds)
- Session-based rate limiting (60s between submissions)
- Header injection protection
- Error messages displayed above form
- Success message after successful send
- Form values preserved on validation errors
- Removed client-side mailto: JavaScript logic
- Added CSS for error display and honeypot hiding
This commit is contained in:
2026-05-14 19:12:43 +00:00
parent 69ca8efa47
commit c2f2709790
3 changed files with 170 additions and 42 deletions

View File

@@ -71,35 +71,7 @@ $(function () {
}
});
// Form submit opens email client with pre-filled mailto: link
$("#contactForm").on("submit", function (e) {
e.preventDefault();
var fname = $("#fname").val().trim();
var lname = $("#lname").val().trim();
var email = $("#email").val().trim();
var phone = $("#phone").val().trim();
var interest = $("#interest").val();
var message = $("#message").val().trim();
var subject = "Kontaktanfrage: " + interest;
var body = "Von: " + fname + " " + lname + "\n";
body += "E-Mail: " + email + "\n";
if (phone) body += "Telefon: " + phone + "\n";
body += "Anliegen: " + interest + "\n\n";
body += message;
var mailto =
"mailto:mki@kies-media.de" +
"?subject=" + encodeURIComponent(subject) +
"&body=" + encodeURIComponent(body);
window.location.href = mailto;
// Show success message
$("#contactForm").hide();
$("#formSuccess").fadeIn(400);
});
// Form submit is handled server-side by PHP no JS intervention needed.
});
// Mobile hamburger menu (vanilla JS)