Monte Carlo particle transport tools can simulate gamma spectrometry results using a pulse-height tally. Such a tally calculates how much energy is deposited in a cell by an entire particle history. This makes its implementation a sophisticated task that requires detailed bookkeeping of the particle and its progeny. So far, the open source Monte Carlo code OpenMC lacked the functionality of the pulse-height tally. This article describes its implementation for photons and presents an extensive validation of its results, which relies on three pillars: analytically-based validation, software-based validation, and experimental-based validation.