Code for sending email (it uses javax.mail API)