wrote code to process emails