0
I am trying to send the email, however is returned the success message, but the message is not sent.
I send the data from the frontend to the backend with Angular and the data arrives straight, 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;
}
Accommodation is the Hostinger. I don’t know if it has anything to do with.
Welcome to Stackoverflow in English. I edited your question to remove the greetings, as we usually keep them as clean as possible to focus on your scheduling question. If you are interested in visiting a part of the site that is not aimed to ask questions can know the Stack Overflow Chat in Portuguese. If you have questions about the operation, rules and procedures of the site visit the Stack Overflow in English Meta :)
– Filipe Moraes
The code uses the client’s e-mail as the sender (From), this could be a problem for the DNS Reverso, ie, basically the recipient checks if the sender IP is the same IP as the sending server and then considers the message as spam if the IP is not the same.
– Filipe Moraes