Fix mail function