We prove the existence and uniqueness of classical solutions to mixed boundary problems for the equation $$ \frac{\partial u}{\partial t}(x,t) - \frac{\partial^2u}{\partial x^2}(x,t) + q(x)u(x,t) = f(x,t) $$ on a closed rectangle, with arbitrary self-adjoint boundary conditions. The initial function, the potential $q(x)$ and $f(x,t)$ belong to some subclasses of $W^{(k)}_p(\cdot)$ ($1