emailing results from spectral-history?

Hi Guys

Is it possible to write a script that performs a spectral-history and then emails me the output?

I have no idea what the syntax would be to retrieve this data?

Thanks