Reputation: 13
I am creating a small application to read email headers.The output is "undefined." Is there a specific coding error, and how can I fix it?
function test() {
var threads = GmailApp.getInboxThreads(0,5)
var messages = threads[0].getMessages();
for (var i = 0; i < messages.length; i++) {
Logger.log(messages.getRawContent);
}
}
Thank you.
Upvotes: 1
Views: 174
Reputation: 45710
You forgot to dereference the array returned by .getMessages()
, is all:
Logger.log(messages[i].getRawContent);
^^^
Upvotes: 1