我正在尝试使用GAS邮寄gdocs的内容(而不是附件),我尝试将文件导出为HTML然后邮寄相同的内容。我可以知道还有其他工作吗。
function test_mail_() {
var id = DocumentApp.getActiveDocument().getId();
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();
var raw = Utilities.base64EncodeWebSafe("Subject: Test\r\n" +
"From: " + Session.getActiveUser().getEmail() + "\r\n" +
"To: test@gmail.com\r\n" +
"Content-Type: text/html; charset=UTF-8\r\n\r\n" +
html + "\r\n\r\n");
var message = Gmail.newMessage();
message.raw = raw;
var sentMsg = Gmail.Users.Messages.send(message, 'test@gmail.com');
}
I need something like this without padding
此外,我在文档中插入的图纸不会显示在邮件内容中。