send mail logic update