mail logic interated with test cases