2013-04-04 90 views
0

我完全不熟悉Google Script,我試圖找出如何將我已標記爲「R/R(short)/ R(ASAP)」的郵件加上星號已經持有該標籤至少一天。有什麼建議麼?下面是我到目前爲止有:使用谷歌腳本發送Gmail郵件

function star2do() { 
var delayDays = 1 // Enter # of days before messages are starred 
var maxDate = new Date(); 
maxDate.setDate(maxDate.getDate()-delayDays); 
var label = GmailApp.getUserLabelByName("R/R(short)/R(ASAP)"); 
var threads = label.getThreads(); 
for (var i = 0; i < threads.length; i++) { 
if (threads[i].getLastMessageDate()<maxDate) 
    { 
    threads[i].markUnread(); 
    threads[i].addLabel(star) //this is where I'm having issues 
    } 
} 
} 

回答

2
threads[i].getMessages()[0].markUnread().star(); 

希望這有助於:)