solved problem of automatic mail function