finish send mail function