Code moved from mail.ml to the new abstract_mail class