我需要在脚本中添加空间或新行方面的帮助。它看起来像这样:
function myFunction() {
var firstThread = GmailApp.getInboxThreads(0,1)[0];
var message = firstThread.getMessages()[0];
var sender = message.getFrom();
var body = "This email is sent from:" + " " + sender + message.getPlainBody();
var subject = message.getSubject();
var attachment = message.getAttachments();
GmailApp.sendEmail("user.name@aruba.com", subject, body, {attachments: attachment});
}
我需要添加 "message.getPlainBody();"
在 "This email is sent from:" + " " + sender "
下的新行上
现在所有内容都位于电子邮件中的同一行。有没有类似html标签<br>
之类的东西?
最佳答案
您可以插入linebreak/newline字符串中用于开始新行的字符。 请注意 \n 实际上算作 1 个字符(\开头是 escape sequence )
var body = "This email is sent from:\n" + sender + "\n\n" + message.getPlainBody();
关于javascript - 添加新行或空格到输出空间或新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24186232/