Mail function updated - js