python - AppleScript to process incoming emails in Mac Mail.app -


actually problem same this one , answer brought me forward. (summary: want python script running on every incoming email subject , extract data content.)

anyways i'm complete newby applescript , cannot find solution giving content of triggering email parameter python script.

and need pass html content of email.

can point me right direction or bring light dark? thank much.

my applescript looks @ moment , nothing happens although script should print email content now:

using terms application "mail"     on perform mail action messages themessages rule therule         tell application "mail"             repeat eachmessage in themessages                 set thecontent source of eachmessage                 shell script "python completepathtopyscript.py" & thecontent             end repeat         end tell     end perform mail action messages end using terms 

then python script following testing:

import sys  email_data = str(sys.argv[1]) print email_data 

or way how take on data not correct?

try this. note shouldn't use tell application "mail", because event triggered mail, , have access functionality provided mail. using terms application "mail" need in case. can find more information typing command+shift+o , selecting "mail.app". show mail's dictionary, , should starting point further code development. i've modified work without specific rule, workaround issues i've experienced in past:

using terms application "mail"     on perform mail action messages themessages rule therule         repeat eachmessage in themessages             if subject of eachmessage contains "express222"                 set thecontent source of eachmessage                 display alert thecontent             end if         end repeat     end perform mail action messages end using terms 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -