JavaScript mail rules for automation instead of AppleScript

I'm trying to create a Mail.app rule (in OS X Yosemite) using Javascript to automate instead of AppleScript, but I'm stuck in the basics.

I see this code in AppleScript:

using terms from application "Mail" on perform mail action with messages theMessages for rule theRule # actual code here end perform mail action with messages end using terms from 

but I don’t understand how this translates to JavaScript.

Define a function? Set callback? I do not understand.

I see that there is a function performMailActionWithMessages , but I cannot figure out how to make it work.

Any guidance is greatly appreciated!

+6
source share
1 answer

I finally realized:

 function performMailActionWithMessages(messages) { messages.forEach( function(message) { // if you want to iterate }) }; 
+7
source

Source: https://habr.com/ru/post/987218/


All Articles