Skip to content

Instantly share code, notes, and snippets.

@flazz
Created June 17, 2016 15:48
Show Gist options
  • Save flazz/cc2233860257d511c56c75252df12b15 to your computer and use it in GitHub Desktop.
Save flazz/cc2233860257d511c56c75252df12b15 to your computer and use it in GitHub Desktop.
#! /usr/bin/osascript -l JavaScript
Mail = Application('Mail');
release = Mail.accounts.byName("Exchange").mailboxes.byName("release");
messages = release.messages();
histo = messages.reduce(function(acc, msg, ix, arr) {
from = msg.sender();
if (!acc[from]) {
acc[from] = 0
}
acc[from] += 1;
return acc;
}, []);
for (var k in histo) {
console.log(histo[k], k)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment