Probably:
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
header("Location: ".$_SERVER["HTTP_REFERER"]."?sucesso=email");
else
header("Location: ".$_SERVER["HTTP_REFERER"]."?erro=email");
IIRC, many mail servers require that the "From" header be a valid email account on that site; so if, for example, your email address there is "rocknrolla83@example.com"
, you could see if changing the headers to something like this helps:
$headers = 'From: rocknrolla83@example.com' . "\r\n" .
'Reply-To: . $_POST['email'] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
(From https://www.php.net/manual/en/function.mail.php#example-3009)