update mail function