U can use the steps as below:
- import classes from javax.mail and javax.mail.internet packages
- create a Properties object and put value of smtp host in its property
"mail.smtp.host". Please note that this host should be able to/configured to
send mails outside
- create a Session object with this property, like Session session =
Session.getDefaultInstance([prop obj],null)
- create a message object using session object, like Message msg = new
MimeMessage(session)
- set from, to, subject, text using appropriate set methods on msg object.
- Use the static send method of Transport class to send mail.