Refactor email model into mail connector