How to send emails based on the user's input?