[Tutor] Use python to parse the subject line of emails, listen for and react to commands

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Feb 27 00:24:38 CET 2015


On 26/02/2015 20:51, Willie Sims wrote:
> Hello I have been trying to figure out a way to parse the subject line of new emails in Gmail, the subject line will be commands for another python script. I know this isn't the most secure way of doing things but it is for a Beagle Bone, I'm really new to python and don't know of this is even possible though I don't see why not. The way I thought it would work would to have py check email subject lines coming from one sender when it sees a subject  "Command(the command to follow)" it would then start another py script with that command, or otherwise sees the subject Settings(the item to change(the change)) it would change a settings page.
> I haven't found any examples of using py to loop back on itself like this, mostly I'm sure because this is not secure and easy to hack and clunky for remote access,
> I know py can parse emails,  but I cant figure out how to limit to only the subject and only if its in that certain format and only if its coming from a recognized email address and since I'm using 3.4 it seems all the other kind of examples don't work half the time anyway.
> can someone point me in the right direction
>

Will this https://docs.python.org/3/library/email-examples.html at least 
get you going?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list