Implement the function of sending emails