我如何使用PHP发送带有localhost XAMPP的电子邮件

时间:2014-07-07 13:25:45

标签: php email xampp

<?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";
  }
}
?>

我认为发送电子邮件的所有代码都是严格的,但我认为它是xampp的必要配置或者用Xampp发送电子邮件的东西。有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:-3)

请查找从localhost xampp服务器发送电子邮件的步骤的链接。

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

这对我来说非常合适。