Add environment support for emails spooling

This PR adds environment support for emails spooling and closes #9