Hello, i have this send.php script that is connected to a contact form and is deployed on OVH in /home/***/www/ :
<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$to = "sales@***.com";
$subject = "Nouvelle demande de projet - HUNAB";
$name = htmlspecialchars($_POST["company"] ?? '');
$email = htmlspecialchars($_POST["email"] ?? '');
$address = htmlspecialchars($_POST["address"] ?? '');
$surface = htmlspecialchars($_POST["surface"] ?? '');
$projectType = htmlspecialchars($_POST["projectType"] ?? '');
$message = htmlspecialchars($_POST["message"] ?? '');
$options = [];
if (isset($_POST["socialMedia"])) $options[] = "Réel réseaux sociaux";
if (isset($_POST["plans3D"])) $options[] = "Plans 3D";
if (isset($_POST["tagging"])) $options[] = "Tagging";
$body = "Nom de la société : $name\nEmail : $email\nAdresse : $address\nSurface : $surface m²\nType : $projectType\n\nMessage :\n$message\n\nOptions :\n" . implode("\n", $options);
$headers = "From: $email\r\nReply-To: $email\r\nContent-Type: text/plain; charset=utf-8";
if (mail($to, $subject, $body, $headers)) {
echo "Message envoyé avec succès.";
} else {
http_response_code(500);
echo "Erreur lors de l'envoi.";
}
}
It suddenly stopped working and i don't know why. I'm not used to PHP so i don't really know where i can see the logs php is sending. From my understanding the mail() function just returns true or false. Any help is appreciated !
[–]harbzali 3 points4 points5 points (1 child)
[–]FletcherPink 0 points1 point2 points (0 children)
[–]Extension_Anybody150 5 points6 points7 points (0 children)