An attachment from Gmail. This is a regular Blob except that it has an extra getSize() method that is faster than calling
getBytes().length and does not count against the Gmail read quota.
// Logs information about any attachments in the first 100 inbox threads.
var threads = GmailApp.getInboxThreads(0, 100);
var msgs = GmailApp.getMessagesForThreads(threads);
for (var i = 0 ; i < msgs.length; i++) {
for (var j = 0; j < msgs[i].length; j++) {
var attachments = msgs[i][j].getAttachments();
for (var k = 0; k < attachments.length; k++) {
Logger.log('Message "%s" contains the attachment "%s" (%s bytes)',
msgs[i][j].getSubject(), attachments[k].getName(), attachments[k].getSize());
}
}
}
An attachment from Gmail. This is a regular Blob except that it has an extra getSize() method that is faster than calling getBytes().length and does not count against the Gmail read quota.