我正在制作一个表单,该表单从一个人那里收集一些数据,然后使用简单的mailto:
方式将其放在他们的电子邮件客户端中(例如):
<form method="post" action="mailto:[email protected]?subject=Stuff">
<p>Name: <input type="text" name="Name" placeholder="Number"></p>
<p>Address: <input type="text" name="Address" placeholder="Number"></p>
<p>City: <input type="text" name="City" placeholder="Number"></p>
<p>Comment: <input type="text" name="Comment" placeholder="Number"></p>
<p><input type="submit" value="SEND"></p>
</form>
然后出来像这样:
Name=Bob&Address=something&City=more&Comment=elsemore
但我想要的是:
Name=Bob
Address=something
City=more
Comment=elsemore
甚至更好:
Name = Bob
Address = something
City = more
Comment = elsemore
目前是否可以仅在HTML中执行此操作?HTML5和Python是我所知道的(大多也是基本部分)。也许有人可以帮我解决有关此问题的正确代码/脚本。
我确实找到了其他一些帖子,但是它们很旧,无法回答问题。
您需要设置加密类型(enctype="text/plain"
):
<form method="post" action="mailto:[email protected]?subject=Stuff" enctype="text/plain">
<p>Name: <input type="text" name="Name" placeholder="Number"></p>
<p>Address: <input type="text" name="Address" placeholder="Number"></p>
<p>City: <input type="text" name="City" placeholder="Number"></p>
<p>Comment: <input type="text" name="Comment" placeholder="Number"></p>
<p><input type="submit" value="SEND"></p>
</form>
您还可以编写一些内容Javascript
,然后使用该body
参数。但是我不推荐这个。
在大多数情况下,最好让网络服务器处理电子邮件通信。
ASP:http://www.codeproject.com/Tips/371417/Send-Mail-Contact-Form-using-ASP-NET-and-Csharp
PHP:http : //tangledindesign.com/how-to-create-a-contact-form-using-html5-css3-and-php/
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句