表单无法正确使用 Mailto
Form not working with Mailto correctly
我有一个表单作为网站的一部分,我只希望它使用 mailto 属性将所有信息发送到选定的电子邮件地址,但是当我按下提交按钮时,我的电子邮件客户端打开了使用正确的电子邮件发送到但没有主题或正文。有什么我必须添加或做错的想法吗?
<form action="mailto:example@example.com" method="post" enctype="text/plain" class="form-horizontal">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" placeholder="Name">
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-2 control-label">Company</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="company" placeholder="Company">
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="Email">
</div>
</div>
<div class="form-group">
<label for="message" class="col-sm-2 control-label">Message</label>
<div class="col-sm-10">
<textarea class="form-control" rows="3" placeholder="Your Message"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
谢谢大家!
您忘记设置 name
属性!您可以将主题设置为电子邮件地址的参数 (subject
)。试试下面的代码:
<form action="mailto:example@example.com?subject=Test" method="post" enctype="text/plain" class="form-horizontal">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="name" id="name" placeholder="Name">
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-2 control-label">Company</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="company" id="company" placeholder="Company">
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="email" id="email" placeholder="Email">
</div>
</div>
<div class="form-group">
<label for="message" class="col-sm-2 control-label">Message</label>
<div class="col-sm-10">
<textarea class="form-control" rows="3" name="message" placeholder="Your Message"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
我有一个表单作为网站的一部分,我只希望它使用 mailto 属性将所有信息发送到选定的电子邮件地址,但是当我按下提交按钮时,我的电子邮件客户端打开了使用正确的电子邮件发送到但没有主题或正文。有什么我必须添加或做错的想法吗?
<form action="mailto:example@example.com" method="post" enctype="text/plain" class="form-horizontal">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" placeholder="Name">
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-2 control-label">Company</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="company" placeholder="Company">
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="Email">
</div>
</div>
<div class="form-group">
<label for="message" class="col-sm-2 control-label">Message</label>
<div class="col-sm-10">
<textarea class="form-control" rows="3" placeholder="Your Message"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
谢谢大家!
您忘记设置 name
属性!您可以将主题设置为电子邮件地址的参数 (subject
)。试试下面的代码:
<form action="mailto:example@example.com?subject=Test" method="post" enctype="text/plain" class="form-horizontal">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="name" id="name" placeholder="Name">
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-2 control-label">Company</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="company" id="company" placeholder="Company">
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="email" id="email" placeholder="Email">
</div>
</div>
<div class="form-group">
<label for="message" class="col-sm-2 control-label">Message</label>
<div class="col-sm-10">
<textarea class="form-control" rows="3" name="message" placeholder="Your Message"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>