Re: the API - have you seen http://context.io/? It addresses both of your issues:
- Ability to work against the multiple aggregated providers (indexes any IMAP-enabled mailbox, regardless of provider)
- Scriptable incoming email processing (not necessarily realtime, but close) that could move your mail around and integrate with other services