using Ruby as the tool to store all the incoming email to sql server ( mysql , mssql , oracle etc ) , so that the external program can directly access the email without using the POP, IMAP protocol.
This can also use as a backend of the webmail server, and make use of the ROR (ruby on rails) to build the Web2.0 email application just like gmail