commit by vikas to make some changes in mail function