javascript - Google Script - How to move messages with specific domain name to trash -
i trying make script can delete messages don't want in gmail. wrote codes in google script. not working. here work. "if email address not temple university,i move trash". want achieve. function blockemail() { var thread = gmailapp.getinboxthreads(0,1)[0]; var message = thread.getmessages()[0]; var senders = message.getfrom(); var regexp = new regexp("(\w|^)[\w.+\-]{0,25}@(temple)\.edu(\w|$)"); if (senders != regexp) { thread.movetotrash(); message.movetotrash(); } } i searched answer here couldn't find 1 want. here answer found. google apps script - gmail, delete forever e-mails in trash specific label can tell me missed code worked ? or mistakes ? self learner , first time asking question here.