mail to function and replace cancel with reset