We study a cash management system, in which the distribution of the cash flow Xn in period n=1,2,… depends on the state In of a randomly varying environment. Sufficient conditions are found for the optimality of a simple transfer rule, generalizing and partially improving the well-known results for the classical case with independent, identically distributed cash flows. These and further structural results obtained for the cash balance are shown to reduce the computational effort drastically in determining an optimal transfer rule. In addition, structural and computational results w.r.t. the environment are derived. Finally, some examples are given for economic and statistical environments and their interactions with the cash flow process.