refactor emailing, add emailing with relpies