add email logic