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
}
);
}
嗨!我遇到了这段代码的麻烦。
除了文字外,它运行得很完美。它没有大胆或颜色。
答案 0 :(得分:0)
MailApp.sendEmail({ 发邮件, 主题:主题, htmlBody:html });