【问题标题】:How to make a line break in Email?如何在电子邮件中换行?
【发布时间】:2021-11-28 19:07:54
【问题描述】:

所以我一直在用这个代码做一个电子邮件发件人:

                var link = "mailto:example@gmailcom"
                + "?cc=myCC@gmail.com"
                + "&subject=" + encodeURIComponent("Order")
                + "&body=" + encodeURIComponent("Some random send string <br>Some more send string")
                ;

            window.location.href = link;

但是,
标签不起作用。有人知道如何换行吗?

【问题讨论】:

  • 你试过\n吗?
  • 另见this

标签: javascript email


【解决方案1】:

因为你正在编码中断标签:

encodeURIComponent("Some random send string <br>Some more send string")
// 'Some%20random%20send%20string%20%3Cbr%3ESome%20more%20send%20string'

【讨论】:

  • 我认为这不是问题所在。接收 mailto 的任何东西都可能不会将 &lt;br&gt; 解释为换行符。编码实际上是正确的,但&lt;br&gt; 应该是\n
猜你喜欢
  • 2022-01-10
  • 2018-04-09
  • 2011-03-01
  • 2013-05-23
  • 2016-05-23
  • 2021-09-02
  • 2012-04-02
  • 1970-01-01
  • 2011-03-13
相关资源
最近更新 更多