mail working, adding some basic error handling.