Google Apps脚本中的错误:使用getPlainText时出现mime类型错误

时间:2013-08-21 03:15:26

标签: google-apps-script

当我尝试使用GmailMessage类的getPlainBody()方法时。当我执行以下代码时,会显示错误消息“无效的MIME类型”。任何人都可以帮我验证代码中的错误吗?

function processLabel(labelName) {
  var targetLabel = GmailApp.getUserLabelByName(labelName);
  var targetThreads = targetLabel.getThreads();
  return targetThreads;
};

function getEmailPlainText() {
  var targetThreads = processLabel('@today');
  var threadsCount = targetThreads.length;
  for (var i = 0; i < threadsCount; i++) {
    var targetThread = targetThreads[i];
    var messageCount = targetThread.getMessageCount();
    var subject = targetThread.getFirstMessageSubject();
    var lastMessage = targetThread.getMessages()[messageCount-1];
    var lastMessageContent = lastMessageContent = lastMessage.getPlainBody();
};    

1 个答案:

答案 0 :(得分:0)

当邮件包含某种类型的附件时,这似乎是一个错误。

Check here and vote it up