Well for sending mail you could just use the smtp function of the advanced mail module in the appstore. For retrieving mail you would have to build some kind of imap poller or imap idle implementation.
Google has some samples using open source libraries that you can find here.
Thank you Pieter. I have been looking at the google source libraries. I want to set up a mail exchange server (both sending and receiving) through Gmail API. I'm really wondering if anyone has tried this implementation on Mendix and how their experience with it was.
I'm also having a hard time running the sample scripts Google API has to offer.