Reputation: 35
I'm trying display starred mails in Logger.
function viewStarred() {
Logger.log( GmailApp.search('is:starred') );
}
but result in my Logger is this:
[GmailThread, GmailThread, GmailThread, GmailThread, .... GmailThread]
how can I display mail subjects? or content...
Here is my screen:
Upvotes: 1
Views: 1405
Reputation: 7965
What you are seeing is behaviour as expected. If you see the documentation for GmailApp.search, you'll see that it returns an Array of GmailThread objects. Logger.log cannot print out a GmailThread array object directly
So, you have to a. Single out the GmailThread object you want to print b. Print specific information about a GmailThread (subject, sender etc.)
See example below
var threads = GmailApp.search('is:starred');
for (var i in threads){
Logger.log(threads[i].getFirstMessageSubject());
}
Upvotes: 1