How do I send out mail using the JavaMail API without using an SMTP host provider?

Serge Knystautas

You cannot send out mail without any knowledge of who is receiving it. In JavaMail if you do not explicitly specify the outbound mail server, it will assume localhost. If you want to avoid using a single SMTP host provider to send outgoing messages, you can use a DNS library package (such as http://www.xbill.org/dnsjava/) to query the MX records of the recipients of their message, and send the mail directly to their server.