This will take quite a bit of custom coding to accomplish. Feel free to post on our job board forum, where you may be able to receive help from WebAssist community members.
Here's a site that may have some additional helpful information to get you started:
access-gmail-with-php-and-xml/