now with email sending functions but yet to decide where to put this file finally