working on mail functionality