update MailHandler to use threads for sending mails