Automator / AppleScript for Mac Inbox Processing

I am developing an application that allows users to send me crash messages if my application ever crashes. I would like to leave Mac Mail on the computer, and when the email arrives, the script / AppleScript machine starts processing the contents of the email body.

I have all the parsing / processing done in a python script, except that I need to manually copy the contents of the email to a file and then run my parser in that file.

What is the best way to configure this so that I can paste the contents of the email into my parsing script?

Many thanks!

+3
source share
3 answers

, - Mail.app. , , , , - AppleScript . Mail.app PreferencesRules. Apple Mac OS X. /Library/Scripts/Mail Scripts/Rule Actions .

+8
+1

Use the dictionary in the Applescript editor to view mail properties, and you can quickly see the properties of any mail message. Here is a quick and dirty example of retrieving the contents of an email message.

tell application "Mail"
    set the_messages to selection
    repeat with this_message in the_messages
        set mytext to content of this_message
    end repeat
end tell

Modify the above script that copies the output to a temporary file and then passes that file to your Python script to act.

+1
source

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


All Articles