fixed logout issue, and implemented email notifications successfully