final version of email sending system