Middleware layer to expose email to BI algorithms