The Malliavin calculus and stochastic delay equations