0
I am trying to validate an email to send a form on php, but it’s hard. My code is below, where I’m missing?
$subject2 = utf8_decode ('Formulário 2016 - PRE-CADASTRO');
$body2 = $mensagem_confirmacao;
if (filter_var($mail, FILTER_VALIDATE_EMAIL))
{
if (mail($to, $subject, $body, $headers)) {
mail($mail, $subject2, $body2, $headers);
echo "<p>Inscrição enviada com sucesso!</p>";
} else {
echo "<p>Erro no envio, Houve algum erro no envio.Tente Novamente ";
}
} else {
echo "<p>E-mail ".$mail." inválido <a href='inscreva-se.php'>Houve algum erro no envio.Tente Novamente</a>!</p>";
}
friend it is interesting to put what problem is occurring so we can be more precise
– Otto
He wants to validate emails @Otto
– Danilo Pádua
this part I understood @Danilo what is difficult to understand is what problem is having because the syntax of filter_var is correct at first. The more information the better the friend, most of the time in the error message this the solution.
– Otto
@paulorpc what is the specific error? put to help you.
– Bia
then friends the error can be visualized in this form: http://www.abimo.org.br/premioinovasaude/increva-se.php. I fill in all fields and when I click to send it the message that the "email is invalid" and does not send nda
– paulorpc