Fix library-loading code and move MailSender to logit.mail