complete email funciton and sessions