E-mail error handling

Error handling and logging added to e-mail module