\r\n"; $headers .= "Reply-To: $name <$email>\r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); // Send the email using the mail() function that we confirmed works $success = mail($to, $subject, $emailBody, $headers); if (!$success) { $errorMessage = 'Es gab ein Problem beim Senden Ihrer Nachricht. Bitte versuchen Sie es später erneut.'; error_log("Mail sending failed for $email"); } else { error_log("Email sent successfully to $to from $email"); } } // Redirect back to the form with status if ($success) { header('Location: index.html?form_success=1#contact'); } else { header('Location: index.html?form_error=' . urlencode($errorMessage) . '#contact'); } exit; ?>