【发布时间】:2019-10-25 09:13:56
【问题描述】:
我正在编写一个网站并添加了一个联系表。当我尝试通过提交来测试表单时,它只会打开电子邮件客户端让我通过电子邮件客户端发送它(它会自动打开我的苹果邮件)。我希望用户能够在不打开设备上的电子邮件客户端的情况下提交表单,然后我想收到一封电子邮件,说明客户已从我的网站向我发送了一条消息。我该怎么做呢?我错过了什么或做错了什么?
<form method="post" action="myemailhere@gmail.com" action="action_page.php">
<label for="fname">First Name</label>
<input type="text" id="fname" name="firstname" placeholder="Your name...">
<label for="lname">Last Name</label>
<input type="text" id="lname" name="lastname" placeholder="Your last name...">
<label for="country">e-mail</label>
<input type="text" id="lname" name="lastname" placeholder="Your e-mail address...">
<label for="subject">Subject</label>
<textarea id="subject" name="subject" placeholder="Write something..." style="height:200px"></textarea>
<input type="submit" value="Submit">
</form>
</div>
<form method="post" action="nuramelodyhill@gmail.com" >
<input type="submit" value="Send Email" />
</form>
【问题讨论】:
-
摆脱
action="myemailhere@gmail.com"。邮件应由action_page.php发送。 -
这里有两张表格,没有一张。
-
您是否在服务器端脚本中实现了发送电子邮件的功能?从 html 表单中,您只能将消息的内容发布到服务器,电子邮件的实际发送必须由服务器承担。