Skip to content

Commit

Permalink
Added code for archiving mail afer processing.
Browse files Browse the repository at this point in the history
Archiving of mail after successful processing.
  • Loading branch information
Bas-Man committed Sep 7, 2020
1 parent 1cb771d commit 4b62454
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ Change Log:
**Version 4.1 Dated:**

- Improved WebApp interface for small screen use.
- Option to archive email after processing
- Option to specify the contract type. PV or FTI
2 changes: 2 additions & 0 deletions code/configuration.js.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ const updatedFilter = "newer_than:1d and label:Berlitz/Schedule AND label:Proces
const baseLC = "Akasaka"; // Set your Base LC here
const writeSpreadSheet = true or false // Set false if you are not writing a spreadsheet.
const showMaterial = true or false
const archive = true or false
const contractType = "PL" or "FTI"
2 changes: 2 additions & 0 deletions code/configuration.js.sample2
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ const filter = "Provide your Gmail search filter Rules here";
const baseLC = "Put your LC name here";
const writeSpreadSheet = true or false // Set to false if you are not using a spreadsheet.
const showMaterial = true or false
const archive = true or false
const contractType = "PL" or "FTI"
8 changes: 7 additions & 1 deletion code/mail.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function getRelevantMessages(filter)
{
var count = thread.getMessageCount();
if(count > 1) {
Logger.log("Found " + count + " messages. Using the last message");
// More than one message in the thread, get the last message in the thread
messages.push(thread.getMessages()[count - 1]);
} else {
Expand All @@ -29,6 +30,11 @@ function labelMessageAsDone(message){
if(!label_obj){
label_obj = GmailApp.createLabel(label);
}
label_obj.addToThread(message.getThread() );
label_obj.addToThread(message.getThread() );

// Archive this message if configured
if(archive) {
message.moveToArchive();
}

}

0 comments on commit 4b62454

Please sign in to comment.