使用预定义的消息打开邮件客户端,并允许用户选择地址


Open mail client with predefined message and allow user to select address

>我有一个问题。我需要创建一个链接,如果用户单击该链接,用户本机电子邮件客户端将打开预定义的消息,但用户必须能够选择收件人地址。我知道 mailto 命令,但我找不到允许用户选择自己的收件人地址的方法。有人可以帮助我吗?

如果你想在没有默认地址的情况下创建默认正文副本,你只需忽略地址:

<a href="mailto:?body=This is the body copy.">Send email</a>

不清楚你想要什么。您希望用户在浏览器或邮件应用程序中定义电子邮件吗?这里有一个jsfiddle来展示如何在浏览器中定义它:

http://jsfiddle.net/Vxgmw/

<p><input type="radio" name="email" value="support@apple.com" />Apple</p>
<p><input type="radio" name="email" value="support@microsoft.com" />Microsoft</p>
<p><input type="radio" name="email" value="dev.null@example.com" />Linux</p>
<p><input type="radio" name="email" value="other" />Other: <input type="text" name="other_email" /></p>
<p><pre id="mailto_link"></pre></p>
$(function() {
    $(':radio[name=email]').on('change', function() {
        if ($(this).val() == 'other') {
            $('#mailto_link').text('mailto:'+$('input[name=other_email]').val()+'?this+is+the+predefined+message');
        }
        else {
            $('#mailto_link').text('mailto:'+$(this).val()+'?this+is+the+predefined+message');
        }
    });
    $('input[name=other_email]').on('keyup', function() {
        if ($(':radio[name=email]:checked').val() == 'other') {
            $('#mailto_link').text('mailto:'+$(this).val()+'?this+is+the+predefined+message');
        }
    });
});