Add error checking for sendEmail function
Remove unnecessary instantiation of class.