我很担心在哪里放置" mailto"我的代码中的地址。我希望每条评论都能发送到特定的电子邮件地址,我希望我们能够提供姓名,地址和评论部分。
https://jsfiddle.net/turkr/jc74awsc/1/
<div class="container-fluid bg-3 text-left" id="contact">
<h3 id="contact"><span>CONTACT</span></h3>
<div class="row">
<div class="col-sm-5">
<p>Contact us by..</p>
<p><span class="glyphicon glyphicon-map-marker"></span> 191 prom du Portage, Gatineau, QC</p>
<p><span class="glyphicon glyphicon-phone"></span> 613-123-456</p>
<p><span class="glyphicon glyphicon-envelope"></span> myemail@something.com</p>
</div>
<div class="col-sm-7">
<div class="row">
<div class="col-sm-6 form-group>
<input class="form-control" id="name" name="name" placeholder="Name" type="text">
</div>
<div class="col-sm-6 form-group">
<input class="form-control" id="email" name="email" placeholder="Email" type="email">
</div>
</div>
<textarea class="form-control" id="comments" name="comments" placeholder="Comment" rows="5"></textarea><br>
<div class="row">
<div class="col-sm-12 form-group">
<button class="btn btn-default pull-right" type="submit">Send</button>
</div>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
您可以使用html required属性
https://www.w3schools.com/tags/att_input_required.asp
Can I set subject/content of email with using mailto:?
你必须使用javascript用正确的mailto内容填充href,建议你做后端而不是使用mailto
<div class="col-sm-6 form-group" action>
<input class="form-control" id="name" name="name" placeholder="Name" type="text" required>
</div>
<div class="col-sm-6 form-group">
<input class="form-control" id="email" name="email" placeholder="Email" type="email" required>
</div>
</div>
<textarea class="form-control" id="comments" name="comments" placeholder="Comment" rows="5" required></textarea>
答案 1 :(得分:0)
您需要一个带有action=somePhpScript.php
属性的表单,该表单会将表单数据发送到您发送电子邮件的后端。 Mailto链接仅用于在您的邮件客户端中打开新的电子邮件