如何发送电子邮件以显示“ " 换行符后跟半角空格?

问题描述 投票:0回答:1

[面临的问题]
如果我在输入“后立即输入”空白“ (换行)”在正文中,“空白”变成两个。
[脚本]

function sendEmail() {
  MailApp.sendEmail({
    to: "test@example.com",
    subject: "Test",
    body: "───────────────\n Hello, world!", //<-1 blank
  });
}

[结果]
────────────────
你好世界! <-2 blanks at the beginning


[我尝试过的]

function sendEmail() {
  MailApp.sendEmail({
    to: "test@example.com",
    subject: "Test",
    body: "───────────────\n&nbsp;Hello, world!",
  });
}

[结果]
────────────────
你好世界! <-displayed as is

[想要达到的目标]
我要一张空白显示器。

email google-apps-script gmail whitespace
1个回答
1
投票

您可以尝试使用 Unicode 转义序列 以及 unicode 中所需的 空白字符(例如,

200A
(头发空间)或
2009
(薄空间)):

body: "───────────────\n\u{00A0}Hello, world!"
© www.soinside.com 2019 - 2024. All rights reserved.