added login and mailer functionality