回复电子邮件

时间:2013-03-22 09:58:30

标签: php email

就是这样,我正在一个网站上工作,在我的市政当局制造火灾

问题是您无法回复电子邮件,因为其中一个用户必须能够使用konakt。

 <form action="#" method="post">
          <table>
             <tr>
                <td>Navn</td>
                <td><input type="text" name="navn" class="new"></td>
             </tr>
             <tr>
                <td>Efternavn</td>
                <td><input type="tel" name="efternavn" class="new" maxlength="8"></td>
             </tr>
             <tr>
                <td>Email</td>
                <td><input type="email" name="email" class="new"></td>
             </tr>
             <tr>
                <td>Tekst</td>
                <td><textarea name="tekst" cols="35" rows="10"></textarea></td>
             </tr>
             <tr>
                <td><input type="submit" name="send" value="Send" class="new"></td>
                <td></td>
             </tr>
          </table>
       </form>
       <?php
       if(isset($_POST["send"]))
       {
          $fra = $_POST["navn"] . $_POST["efternavn"] . " - <" . $_POST["email"] . ">";
          $email = "info@blablla.dk";
          $title = $_POST["navn"] . " Kontakt - Website";
          $tekst = $_POST["tekst"];

          //headers
          $headers = "MIME-Version: 1.0";
          $headers .= "Content-type: text/html; charset=UTF-8";
          $headers .= "From: " . $fra . "";

          mail($email, $title, $tekst, $til);
          echo "den er sendt nu NY";
       }
       ?>

以下是:

" - <" . $_POST["email"] . ">";

不会显示您为了站在blabla@meebox.dk或者看起来像在静止中而写的电子邮件,但我希望这是他写的用户

2 个答案:

答案 0 :(得分:0)

您无法在name of field中定义type attribute of the field

 <form action="" method="post">
          <table>
             <tr>
                <td>Navn</td>
                <td><input type="text" name="navn" class="new"></td>
             </tr>
             <tr>
                <td>Efternavn</td>
                <td><input type="text" name="efternavn" class="new" maxlength="8"></td>
             </tr>
             <tr>
                <td>Email</td>
                <td><input type="text" name="email" class="new"></td>
             </tr>
             <tr>
                <td>Tekst</td>
                <td><textarea name="tekst" cols="35" rows="10"></textarea></td>
             </tr>
             <tr>
                <td><input type="submit" name="send" value="Send" class="new"></td>
                <td></td>
             </tr>
          </table>
       </form>
       <?php
       if(isset($_POST["send"]))
       {
          $fra = $_POST["navn"] . $_POST["efternavn"] . " - <" . $_POST["email"] . ">";
          $email = "info@blablla.dk";
          $title = $_POST["navn"] . " Kontakt - Website";
          $tekst = $_POST["tekst"];

          //headers
          $headers = "MIME-Version: 1.0";
          $headers .= "Content-type: text/html; charset=UTF-8";
          $headers .= "From: " . $fra . "";

          mail($email, $title, $tekst, $til);
          echo "den er sendt nu NY";
       }
       ?>

现在尝试一下,它会起作用。

答案 1 :(得分:0)

如果您希望用户可以回复您的邮件,则必须将其添加到您的标题代码中。

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

这可能对你有帮助。