So, I have hostinger server. It's a shared server. Before all my Php Forms worked like a charm. I have different sites and all worked fine. But one day I noticed, all stopped working. It says mail has been sent, but does not send any mail. I am not sure if the issue on server side or the code. Because same code used to work.
I am dropping a random code from one of my site. The file is mail.php.
<?php
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$EmailTo = "example@gmail.com";
$Title = "New Message Received";
// prepare email body text
$Fields .= "Name: ";
$Fields .= $name;
$Fields .= "\n";
$Fields.= "Email: ";
$Fields .= $email;
$Fields .= "\n";
$Fields.= "Subject: ";
$Fields .= $subject;
$Fields .= "\n";
$Fields .= "Message: ";
$Fields .= $message;
$Fields .= "\n";
// send email
$success = mail($EmailTo, $Title, $Fields, "From:".$email);
Here I have replaced my main email and wrote example@gmail.com Just to hide the email id. In my website, it was my own email.