send mail function fix