complete mail function