【问题标题】:How to send rich text emails with GmailApp_2?如何使用 GmailApp_2 发送富文本电子邮件?
【发布时间】:2018-03-24 09:12:46
【问题描述】:

来自first question

function emailGoogleDoc(){
var id = DocumentApp.getActiveDocument().getId() ;
var forDriveScope = DriveApp.getStorageUsed(); //needed to get Drive Scope 
requested
var url = "https://docs.google.com/feeds/download/documents/export/Export?
id="+id+"&exportFormat=html";
var param = {
method      : "get",
headers     : {"Authorization": "Bearer " + ScriptApp.getOAuthToken()},
muteHttpExceptions:true,
};
var html = UrlFetchApp.fetch(url,param).getContentText();
Logger.log(html);

var email = person@domain.tld;  
var subject = 'Subject line';
var body = "To view this email, please enable html in your email client.";

MailApp.sendEmail(
    email,           // recipient
    subject,         // subject 
    body, {          // body
    htmlBody: html // advanced options
  }
);
}

嗨!我在处理这段代码时遇到了问题。

除了文字外,它运行完美。它没有粗体或颜色。

【问题讨论】:

    标签: google-apps-script gmail-api google-docs-api


    【解决方案1】:

    MailApp.sendEmail({ 发邮件, 主题:主题, html正文:html });

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多