[SOLVED]reading email subject INTO variable

Posted on
Fri Jan 10, 2014 12:46 pm
mike_c offline
Posts: 37
Joined: Oct 03, 2013

[SOLVED]reading email subject INTO variable

Is there a way to read an email subject into a variable? (this is different to emailing the value of a variable).

I'd like to be able to send a mail such as "action:heating on" - interpretation / conditional logic would validate the source email address and the fact that the word action appears in the subject to run action group "heating on".

I want to avoid having to set a trigger from every single action i want to be able to control hence the need to read the subject (after the ":"), put into a variable and have applescript execute the action group based on that variable name.

any thoughts ? or perhaps I'm coming at it from completely the wrong direction.

thanks

Posted on
Fri Jan 10, 2014 2:51 pm
jay (support) offline
Site Admin
User avatar
Posts: 18260
Joined: Mar 19, 2008
Location: Austin, Texas

Re: reading email subject INTO variable

Indigo's built-in mail handling can't do that. You'd need to write a script to do the actual mail checking - then it could parse the parts out and do other things based on that.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Jan 11, 2014 4:33 pm
AndrewGWalsh offline
Posts: 67
Joined: Feb 20, 2013

Re: reading email subject INTO variable

I'd quite like to be able to do this - can you suggest how to trigger the script?

TIA

Andrew

Posted on
Sat Jan 11, 2014 7:25 pm
jay (support) offline
Site Admin
User avatar
Posts: 18260
Joined: Mar 19, 2008
Location: Austin, Texas

Re: reading email subject INTO variable

To be honest, if I were doing it I would probably write a plugin. I'd use the ICal Alarm plugin as the starting point because it already has the logic for polling an IMAP server, deleting messages, and getting/parsing data from the message.

But you could just as we'll write a Python script that just stays open polling the IMAP server.

I would like to point out that this is somewhat a security risk since it's fairly simple to send an email that looks like it's from someone else... :wink:

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jan 13, 2014 2:44 am
AndrewGWalsh offline
Posts: 67
Joined: Feb 20, 2013

Re: reading email subject INTO variable

Thanks for that - a bit beyond me at the moment but I may come to it as I become more capable.

I appreciate that Email is insecure but for certain applications it doesn't matter - and at the moment the only way I can see of integrating with IFTTT is via Email.

Andrew

Posted on
Mon Jan 13, 2014 10:11 am
jay (support) offline
Site Admin
User avatar
Posts: 18260
Joined: Mar 19, 2008
Location: Austin, Texas

Re: reading email subject INTO variable

We contacted IFTTT shortly after they launched about adding channels. Unfortunately, they didn't reply.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Apr 08, 2014 6:39 am
mike_c offline
Posts: 37
Joined: Oct 03, 2013

Re: [SOLVED]reading email subject INTO variable

For reference, I solved this with a mail rule in mail.app rather than an indigo trigger.

I have three primary rules:

1. act as a help function:
- iterates through all variables and values; adding each to the reply email message
- iterates through all action groups; adding each to the reply email message
- i therefore know the state of the system, and what i can do.

2. act as a doing function:
- dependent upon a number of factors (including subject and message payloads to help security)
- triggers the invocation of that action group from applescript (controlling indigo)

3. enable or disable the prism functionality
- i have a push notification through growl to alert when a new, non LAN-based, client connections.
- in the event i receive such a notification that i did not initaite, this gives me the option to 'close the prism door'

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests