【问题标题】:Html email form do not send mail [duplicate]Html电子邮件表单不发送邮件[重复]
【发布时间】:2016-05-06 12:53:37
【问题描述】:

你好,我的网站结束了,我有这个表格:

<section class="contact" id="contact">
    <h1>Contact</h1>
    <hr/>       

    <div class="content">

      <div class="form">

        <form action="#" method="post" enctype="text/plain">

        <input name="your-name" id="your-name" value="Numele Tau" />
        <input name="your-email" id="your-email" value="Adresa de E-mail sau Telefon" />

        <textarea id="message" name="message" >Mesajul Tau</textarea>

        <a href="#">
          <div class="button">
            <span>SEND</span>
          </div>
        </a> 

        </form>

      </div>

我想知道的是如何使用所有这些信息向某个邮件发送电子邮件?

谢谢,对不起我的英语,

【问题讨论】:

  • 作为起点,您将需要一些服务器端代码。你用php 标记了它,但没有提供任何 PHP 代码。寻求调试帮助的问题(“为什么这段代码不起作用?”)必须包括所需的行为、特定问题或错误必要的最短代码 重现它在问题本身。没有明确的问题陈述的问题对其他读者没有用处。见:How to create a Minimal, Complete, and Verifiable example.

标签: php html email


【解决方案1】:

创建一个单独的 PHP 文件,例如 sendmail.php。将开头的&lt;form&gt; 标记更改为以下内容:

<form action="sendmail.php" method="post">

这里是 sendmail.php 的一些基础代码:

<?php
    $message = $_POST['your-name'] . ' Sent the following message at ' . date('d-m-Y H:i') . '. Their email is ' . $_POST['your-email'] . '. ' . $_POST['message'];
    mail('adminemail@site.com', 'New contact form', $message);
?>

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-22
  • 1970-01-01
相关资源
最近更新 更多