importing logging.handler because only importing logging breaks sending email when there is a faliure