update to do cookie work in mailapi.js