Hello all,
I need to detect when specific email message has arrived, via Mail.app, apply a Rule to that message which invokes an AppleScript. The AppleScript needs to parse the message for a few known nuggets embedded in the message contents, form a URL with the nuggets, either for _POST or _GET, and call a PHP script on a server, which will then process the arguments and send the email sender a customized message.
Here’s what I have so far:
-
Mail.app recognizes the specific email, and applies a Rule, which invokes an AppleScript
-
A PHP script which takes either _POST or _GET args and handles them accordingly.
What I’m missing is two key things:
-
how to get the contents of the mail message specified by the Mail.app, and parse it in AppleScript to extract the nuggets I need, and
-
how to properly form a URL with AppleScript such that “curl” can use it. I am running in to trouble with the URL argument delimiter “&” – I suspect because it’s also an AS keyword.
Could anyone please help with either of these problems?
(Alternatively, is it possible to get the contents of the mail message, and hand off the entire thing to the PHP script, and do the tokenisation work there instead?)
thank you,
womble