On our system the servlet was running on one machine and the email server was on a different box. The Network Admin was able to make some setting changes on Exchange that allowed me to email outside our domain. So if you have the same problem that I did, your code is correct it is just you network settings need to be changed.
Aaron
There are two ways to fix this :
1. Your must set up the mail server to allow mail relaying from the IP address where the javamail program is running.
2. If the program will not always run from the same address, you can setup the mail server to allow mail relaying for authenticated sessions. (Note that Sun's JavaMail implementation presently only supports the authentication mechanism LOGIN, that the mail server will have to support too)
Mail relaying : the ability for an SMTP server to act as an SMTP client with a foreign SMTP server - thereby passing the mail outside it's own domain.
I'm replying specifically for GroupWise but MS Outlook/Exchange will in essence be the same.
When you send an email from your PC using GroupWise, the GWIA (ie the SMTP server) is what actually sends the email. This is on a server somewhere but NOT on your PC.
When using Javamail, you are really operating another smtp client. The GroupWise GWIA is likely configured not to accept relaying. If it is, for example if you use a mail filtering system so relay all mail, it is likely configured to accept relaying from only that IP address. Your PC (or wherever you are running the Javamail from) is unlikely to be an 'allowed' relay source.
In GroupWise you can add as many relay sources as you like under the GWIA object. Again, Is imaging Exchange is similar.
Nick.