I'm trying to send an email, but the success message is returned, but the message is not sent.
I send the data from the frontend to the backend with the Angular and the data arrives right, but I do not know what happens that does not send.
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
header("Access-Control-Allow-Headers: X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");
$_POST = json_decode(file_get_contents('php://input'), true);
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$place = $_POST['place'];
$message = $_POST['message'];
$destino = "[email protected]";
$assunto = "Cliente.";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: $name <$email> '. "\r\n";
$headers .= 'Telefone: $phone '. "\r\n";
//....
$enviaremail = mail($destino, $assunto, $headers);
if($enviaremail)
{
echo 1;
}
else
{
echo 0;
}
The host is the hostinger. I do not know if there's anything to see.