You will need to somehow check your mailbox, process the mails and parse the contents to the system shell. There is probably no turnkey solution for this; you will need to develop your own.
disclaimer: I'm giving you my ideas but there's tons of ways and starting points really.
What's probably the best solution? Having a Python script running on the raspberry doing all the work.
PRO: clean, single server solution
CON: (IMHO) it's easier to find PHP examples for doing this than Python ones.
What would be my personal solution:
1) An external PHP webserver checks the mailbox every minute, processes the contents, parses the contents in a queue
2) The raspberry checks that queue every minute via a simple cron'ned
curl and parses that contents to the system in a similar way as you did manually at the command line.
PRO: the least amount of overhead services on your raspberry: no need to run a PHP server.
CON: potential security issues because unsecure communication between the php script and the raspberry.
This most probably will require some development. First ones that come in my mind is Python, Perl or PHP. Have done something similar in PHP this would be my first language of choice. However if you want to run PHP on your raspberry, this will require you to run (at the very least) a PHP server which obviously will eat valuable system resources.
Alternatively you can choose to run the parsing script on an external webserver which already runs PHP, and have the Pi to check that webpage regularly via a cron.
No matter which language you use, if you're leaning towards basic experience level, I'd suggest you don't use a gMail mailbox; these are only accessible via secure layers and - whilst definitely technically capable - will yet add another barrier of problems in your development process. Choose a more basic mailbox (at your provider perhaps). Anyway you can setup your gMail to forward to this address.