You have a few options.
As long as we have python and .NET we must also have PHP. And as long as you got a LAMP installed then this is pretty straightforward. Here is a example of PHP getting emails from GMAIL
- PROS - More likely choice for anybody using Linux as there are many examples and libraries.
- CONS - If you don't like PHP you wills still use it but moan and groan...
Purely because I am a .NET developer I had to test this and it does work. Just make an app in C#/VB and let it do what you need. Compile it as a console application and run it using mono on the Pi. And here is a good starting point.
- PROS - If you like .NET you can do allot of things with the code in that one binary. Xamarin and Raspberry Pi are supported/work together by/with Microsoft Open Source now making it more convenient for .NET'ies.
- CONS - If you do not like .NET or the idea of installing MONO then not for you.
You can try and use 3rd party programs to get mail and use bash to parse data and call other scripts.
- PROS - Not sure but its an option
- CONS - Can be a bit complicated and wont work cross pc without all the dependencies
If you can get postfix installed to recieve emails then you can tell it to dump the emails to a script- any script, bash, php, python or java if you like.
Then your script can parse all this information easy.
- PROS- Easy enough if you can get postfix (or equivalent) installed
- CONS - If you have no static IP then you need dyndns
This is obviously what you asked. You want to fetch email. This sounds easy enough but can be quite complex in trying to get the email and parsing it. But you are not alone because here is a good tutorial that uses python to parse your GMAIL RSS feed.
- PROS - You do not need to run a SMTP server like postfix behind dyndns
- CONS - I would not do it like this because getting the emails, parsing them, connecting to remote servers seems complicated (and no 1 way) to do it. Prone to many errors
This is a bit of experimental and combination of the two above. Allot of control panels (if you own a domain with some baisc hosting - like justhost) will allow you to dump selected emails to a script (like postfix above). You then parse it on that server and use curl to call your Pi (on DynDns if you dont have static) with specific commands and authentication.
- PROS- Decentralization and modularity.
- CONS - Experimental
Socks5 / HTML5 Web Messages
As in your comment this is also a viable option. Socks opens a socket between the server and browser and stays open allowing you to send and receive messages instantly, between many connections. Node.JS Chat example is a good place to start. SignalR is amazing! And other languages support some kind of socks too.
- Remember to add some basic authentication in anything you do. Even in your emails put a line with encrypted text that your raspberry will decrypt so it knows its you and not some idiots attacking your system. To increase the security make it a mutating key that for example incorporates a timestamp(dd-mm-yy) so each day it will be encrypted differently but your Pi will know how to decrypt it.
- You can automate your scripts using CRON