2
<?php
      // display form if user has not clicked submit
      if (!isset($_POST["submit"])) {
      ?>

      <form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post" style="width:100%; margin: 0 auto;">
        <p>
          <label>Nome:</label>
          <input name="textName" type="text" size="30" />
          <label>Email:</label>
          <input name="textEmail" type="text" size="30" />
          <label>Assunto:</label>
          <input name="textTitle" type="text" size="30" />
          <label>O seu comentário:</label>
          <textarea name="textarea" cols="5" rows="5"></textarea>
          <br />
          <input class="button" type="submit" value="Enviar"/>
        </p>
      </form>

      <?php 
      } 
      else 
      {    // the user has submitted the form
      // Check if the "from" input field is filled out
        if (isset($_POST["textEmail"])) {
            $from = $_POST["textEmail"]; // sender
            $subject = $_POST["textTitle"];
            $message = $_POST["textarea"];
            // message lines should not exceed 70 characters (PHP rule), so wrap it
            $message = wordwrap($message, 70);
            // send mail
            mail("rubencpires@hotmail.com",$subject,$message,"From: $from\n");
            echo "Thank you for sending us feedback";
  }
}
?>

I think all the code for send an email is rigth but i think its necessary configuration to xammpp or something to send emails with Xammpp. Someone can help me?

user3812483
  • 17
  • 1
  • 1
  • 3

1 Answers1

-3

Please find link for the steps to send email from localhost xampp server.

http://www.websnippetz.blogspot.in/2013/01/send-email-from-xampp-localhost.html

This is worked perfectly for me.

trincot
  • 317,000
  • 35
  • 244
  • 286