使用Google Apps脚本格式化正文电子邮件的替代方案(MailApp.sendEmail) [英] Alternatives to format text of body email using Google Apps Script (MailApp.sendEmail)

查看:245
本文介绍了使用Google Apps脚本格式化正文电子邮件的替代方案(MailApp.sendEmail)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这段代码可以使用Google Apps脚本发送电子邮件:

  var message =Lorem ipsum dolor sit amet,consectetur adipisicing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua+ name +Ut enim ad minim veniam,quis nostrud practitation ullamco laboris+ receiver; 
MailApp.sendEmail(email2Send,title,message);

但接收者的电子邮件中没有格式化,没有段落等。我会至少apreciate段落(新行)但\\ n不起作用。文档告诉我:
$ b


htmlBody如果设置了字符串,那么能够呈现HTML的设备将使用
而不是所需的主体论据;您可以在HTML body中添加一个可选的
inlineImages字段,如果您已为您的
电子邮件添加内联图片


,我可以这样做:

  ... 
var options = {
htmlBody:' < b>< i> TEST< / i>< / b>'
};
MailApp.sendEmail('omeomeone@domain.ext','TEST','TEST',options);
...

有什么方法可以使用<$ c为消息添加格式$ C> MailApp.sendEmail ?你能建议我一个简单的HTML模板为基本的文本格式? (我想比这更简单( Gmail)从电子表格发送电子邮件如何在图片中添加签名?)



感谢您的帮助!


<

<$ p $> p> MailApp.sendEmail( myemailbox@example.sinvalid, 测试, multi\\\
line\\\
text);

用以下内容发送邮件:

 多重

文本


I have this code to send emails with Google Apps Script:

 var message = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua " + name + "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris" + receiver;
 MailApp.sendEmail(email2Send, title, message);

But the email that goes to receiver has no formating, no paragraphs, etc. I would apreciate at least paragraphs (new lines) but \n doesn't work. The documentation tells me that:

htmlBody String if set, devices capable of rendering HTML will use it instead of the required body argument; you can add an optional inlineImages field in HTML body if you have inlined images for your email

So, I could do something like this:

...
var options = {
  htmlBody: '<b><i>TEST</i></b>'
};
MailApp.sendEmail('someone@domain.ext', 'TEST', 'TEST', options);
...

What are the alternatives do add format to a message using MailApp.sendEmail? Could you suggest me one simple HTML templates to a basic text format? (I'd like something simpler than this (Gmail) Sending emails from spreadsheet. How to add signature with image?)

Thanks in advance for any help!

解决方案

\n works.

MailApp.sendEmail("myemailbox@example.sinvalid","test","multi\nline\ntext");

send a mail with the following body:

multi 
line 
text

这篇关于使用Google Apps脚本格式化正文电子邮件的替代方案(MailApp.sendEmail)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆