Email in PHP does not work

1

He gives no error, just does not get the message. Sending normally via a webmail goes normal, follow the form:

<form method="post" action="sendMail.php" id="formMail">
        Assunto: <input name="assunto" type="text" class="txtMail" placeholder=" O assunto do seu email aqui"/><br />
        Mensagem:<br />
  <textarea name="comment" rows="12" cols="50" placeholder=" Sua mensagem aqui"></textarea><br />
  <input type="submit" value="Enviar" /><br><br>
  </form>

and the PHP code:

<?php 
    if(isset($_POST['assunto'], $_POST['mensagem'])){
        $para = "[email protected]";
        $assunto = $_POST['assunto'];
        $msg = $_POST['message'];

        mail($para, $assunto, $msg);
    }
?>

Another question, is there any way to send the email message of who is sending me by the method mail(); ?

    
asked by anonymous 31.01.2015 / 00:05

1 answer

5

Friend, there is an error here:

$msg = $_POST['message'];

The attribute "name" of the tag is "comment", not "message". Leave the variable like this:

$msg = $_POST['comment'];
    
31.01.2015 / 00:22