Fixed the mail function