performace boost in mailapi.js