【问题标题】:How i send emails with localhost XAMPP using PHP [duplicate]我如何使用 PHP 通过 localhost XAMPP 发送电子邮件 [重复]
【发布时间】:2014-08-28 00:00:22
【问题描述】:
<?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";
  }
}
?>

我认为发送电子邮件的所有代码都是正确的,但我认为它对 xammpp 或使用 Xammpp 发送电子邮件的必要配置。有人可以帮助我吗?

【问题讨论】:

    标签: php email xampp


    【解决方案1】:

    请找到从本地 xampp 服务器发送电子邮件的步骤链接。

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

    这对我来说非常有用。

    【讨论】:

    • 这个帖子没用...链接失效... :/
    • 我投了反对票,因为此链接已失效。
    猜你喜欢
    • 1970-01-01
    • 2016-05-13
    • 2017-01-25
    • 1970-01-01
    • 2012-05-07
    • 1970-01-01
    • 2014-06-25
    • 2012-07-03
    • 1970-01-01
    相关资源
    最近更新 更多