<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  $name = $_POST["fullName"];
  $email = $_POST["email"];
  $message = $_POST["message"];
  $to = "info@thedi.or.tz";
  $subject = $_POST['subject'];
  $headers = "From: $email";

  $success = mail($to, $subject, $message, $headers);
  if ($success) {
    http_response_code(200);
    echo 'Message sent!';
  } else {
    http_response_code(500);
    echo 'Failed to send message.';
  }
} else {
  http_response_code(400);
  echo 'Invalid request.';
}
?>

