done automatic mail functionality