【发布时间】:2021-09-05 23:21:31
【问题描述】:
我想创建一个表单,在单击提交按钮时将表单的输入发送到所需的电子邮件。理想情况下,我想使用 HTML。
这是我目前得到的:
<form class="row g-3 needs-validation" novalidate
action=”mailto:myemail@gmail.com”
method=”POST”
enctype=”multipart/form-data”
name=”EmailForm”>
<div class="col-md-4" style="margin-top: 2.4%">
<div class="valid-feedback">
</div>
</div>
<div class="col-md-4">
<label for="floatingInput" class="form-label">First name</label>
<input type="text" class="form-control" id="floatingInput" placeholder="Konnie"></div><br>
<div class="col-md-4">
<label for="floatingInput" class="form-label">Last name</label>
<input type="text" class="form-control" id="floatingInput" placeholder="Smith" required>
</div><br>
<div class="form-floating mb-3">
<input type="email" class="form-control" id="floatingInput" placeholder="name@example.com" required>
<label for="floatingInput">Email address</label>
</div>
<div class="col-12"> <div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="invalidCheck" required>
<label class="form-check-label" for="invalidCheck">
Agree to terms and conditions
</label>
<div class="invalid-feedback">
You must agree before submitting.
</div>
</div>
</div>
<br>
<div class="col-12">
<button class="btn btn-primary" type="submit">Submit form</button>
</div>
</form>
当我尝试提交表单时,我收到此错误:
Not Found
The requested URL was not found on this server.
【问题讨论】:
-
你试过
method="get"吗? -
您是否使用任何后端语言?喜欢 PHP 吗?
-
当然,如果用户没有注册的邮件客户端(例如没有响应mailto协议的程序),它当然不会工作。
-
您不能自动发送带有纯 html 表单的电子邮件 - 这只会打开用户的
mailto处理程序 -
另外,你试过this question的表格吗?如果是,请尝试根据您的需要逐步修改它,看看错误发生在哪里
标签: html form-submit