Updated mail function

Update mail function