finished the email api with promises