I am not receiving the data sent by the user in the email I should receive. Any tips how to resolve?

Asked

Viewed 98 times

0

I need help. I have a contact form working but the name, email and message of the sender does not reach the email of the recipient. Where is the error in php? Since my thank you.

PHP

<?
$nome=$_POST['nome'];

$email=$_POST['email'];

$titulo=$_POST['titulo'];

$texto=$_POST['texto'];


$Destinatario="email a receber";


$Titulo="$titulo";


$mensagem1="

Uma mensagem vinda do site !

Algum vistante mandou essa mensagem pelo site.

Nome: $nome

Email: $email

Mensagem: $texto";


mail("$Destinatario","$Titulo", "$mensagem1","From:$email");

?>

Html code

<form method="post" action="contacto.php">
      <input type="text"  placeholder="Nome"  required="">
      <input type="text"  placeholder="Email " required="" >
      <textarea  placeholder="Mensagem" requried=""></textarea>         

      <label class="hvr-sweep-to-right">
        <input type="submit" value="Enviar">
      </label>
</form>
  • Improve your question and put your code both html and PHP.

  • It might help you. ---> http://answall.com/questions/122488/formul%C3%A1rio-de-contact-n%C3%A3o-funciona-php/122578

  • exchange the <? by <?phpe o mail() faça assim,if(!mail("$Destinatario","$Titulo", "$mensagem1","From:$email")){ echo 'error '. error_get_last();}`

  • Thank you Igor but it did not help. The code that is in the post you recommended also tried, among others and no gives. All say email sent to the user but the truth is that I do not receive anything in my mail. OK I’ve seen your suggestion. I will try

  • rray, unfortunately did not give

  • Have you looked in the box span?

  • Yes Igor, I’ve seen it and nothing.

  • This is what appears in the mail: A message coming from the site ! Some visitor sent this message through the site. Name: Email: Message:

Show 3 more comments

1 answer

2


Put the code below in place of the From:$email

$headers = 'From: '$email . '\r\n' .
    'Reply-To: '. $email . '\r\n' .
    'X-Mailer: PHP/' . phpversion();

leaving the code like this

mail($Destinatario, $Titulo, $mensagem1, $headers);

and also missing "name" attributes in the form

  • We really miss the name="" in tags!

  • Daniel, user name and email already appears but message not yet

  • Dear Friends, problems solved. Thank you very much!!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.