Calculation of Mossbauer spectra in the relaxation regime