complete send mail function