HTML mailto表单:预填主题和正文 [英] HTML mailto form: prefill subject and body

查看:138
本文介绍了HTML mailto表单:预填主题和正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编辑HTML模板,并且需要联系表部分中的帮助。我想做到这一点,以便当用户单击发送邮件按钮时,默认电子邮件客户端(在我的情况下为Outlook)打开,并且电子邮件的名称,主题和正文用表格中的值预先填充。我该怎么办?

I am editing an HTML template and need help in the contact form section. I want to make it so when user clicks on the send message button, then the default email client (in my case, Outlook) opens up and the name, subject and body of the email are pre-filled with the values from the form. How would I do that?

联系表格标记:

<div id="footer" class="container">
    <header>
        <h2>Questions or comments? <strong>Get in touch:</strong></h2>
    </header>
    <div class="row">
        <div class="6u">
            <section>
                <form>
                    <div class="row half">
                        <div class="6u">
                            <input name="name" placeholder="Name" type="text" class="text" />
                        </div>
                        <div class="6u">
                            <input name="Subject" placeholder="Subject" type="text" class="text" />
                        </div>
                    </div>
                    <div class="row half">
                        <div class="12u">
                            <textarea name="message" placeholder="Message"></textarea>
                        </div>
                    </div>
                    <div class="row half">
                        <div class="12u">
                            <a href="#" class="button button-icon icon icon-envelope">Send Message</a>
                        </div>
                    </div>
                </form>
            </section>
        </div>

        <div class="row">
            <ul class="icons 6u">
                <li class="icon icon-home">
                    <h6> 1235 street <br />
                    city, state 0000<br /> </h6>
                </li>
                <li class="icon icon-phone">
                    <h6>(000) 000-0000 </h6>
                </li>
                <li class="icon icon-envelope">
                    <a href="mailto:hello@hello.com">hello@hello.com</a>
                </li>
            </ul>
        </div>
    </div>
</div>


推荐答案

如果我对您的理解正确,则可以使用mailto链接在电子邮件客户端中打开邮件时预先定义邮件的正文和电子邮件。

If I understand you correctly, you can use mailto links to predefine the body and email of a message upon opening in an email client.

<a href="mailto:hello@hello.com?subject=Email Subject&body=Contents of email">hello@hello.com</a>

AJAX表单可能更适合,因为用户不需要电子邮件客户端即可打开链接

An AJAX form may be more suitable as the user would not require an email client to open up the link.

这篇关于HTML mailto表单:预填主题和正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆