We define a regularized theta lift for orthogonal groups over totally real
fields generalizing work of Borcherds. The lift takes harmonic `Whittaker
forms' to automorphic Green functions and weakly holomorphic Whittaker forms to
meromorphic modular forms on orthogonal groups with zeros and poles supported
on special divisors.