https://mail.google.com/mail/feed/atom allows you to get atom feeds for your email. @gmail
The XML can be parsed after getting the email using wget
wget –secureprotocol=TLSv1 –user=xxx –password=yyy https://mail.google.com/mail/feed/atom -O –
TLS is a transport layer security method to encrypt messages being sent on the internet.
A remote machine reading off this feed can parse the feed to receive commands to execute. You can send an email with a certain subject containing the command to be executed.