learning mail function