I am trying to create an Applescript, which will be triggered with a rule, to automatically send out a specific document to an e-mailer. What I want to happen is this:
= An e-mail arrives in the in-box with a specific To address (say: ScriptTips@MacTipMail.com).
= Mail app receives the e-mail on its periodic mail download.
= The To address triggers a rule that creates an e-mail reply, which will go to the sender of the incoming e-mail, and which will have a specific attachment (a PDF doc, say).
Where I am so far is that I can make and send the reply e-mail with the attachment (and the desired subject line and message text). The problem is triggering the rule when the mail arrives at Mail. As I have it now, it will be triggered if I run the script manually with the desired e-mail selected in the Mail inbox. But I want the script to run on the e-mail when it arrives, through a rule, without any need for user intervention.
So what the script needs to do is somehow, as the e-mails arrive, grab the replyto addresses of triggering e-mails, create the appropriate outgoing mail message (determined by the incoming address), and send it. It’s the first step–grabbing the replyto address from the triggering e-mail–that has me stumped.
The secondary problem is that the script only seems to work when it is loaded in the script editor. Not working as an application. Why would that be?