【问题标题】:Link to prefilled email body with form链接到带有表单的预填充电子邮件正文
【发布时间】:2016-10-04 11:49:19
【问题描述】:

我想创建一个链接以打开您的默认电子邮件客户端(例如 iPhone 上的 Gmail),并填写以下内容:

  • 收件人: example@gmail.com
  • 主题:您的订单
  • BODY: [一种形式,而不是 一段文字]

如果正文只是一个文本(见下文),我知道如何执行上述操作,但如果它是例如HTML 表单。

如果只是正文的代码:

<a href="mailto:email@gmail.com?subject=Your%20Order&body=">Click here to send pre-filled email</a>

感谢您的帮助!

【问题讨论】:

标签: html email


【解决方案1】:

this重复

代码如下:

var link = document.getElementById('email');
link.onclick = function() {
    this.href = "mailto:you@yourdomain.com?subject=Data&body=";
    this.href += getBody();
};

function getBody() {
    return 'HelloWorld';
}

【讨论】:

    猜你喜欢
    • 2011-06-24
    • 2018-04-15
    • 2014-07-08
    • 1970-01-01
    • 2012-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多