I don't know what is going wrong but you should not set JNDI properties in the application server.
Drop the first three lines (System.setProperty()) and try again.
Have fun - Andy
forces the jndi lookup to go over RMI
the java:/ context is only within the same VM
If you have a standalone webserver, you cannot
access the jboss mail service.
If your webserver is embedded within jboss,
as Andreas says, don't set the properties.
You are right! I try the 'java:\Mail' in the
EJB ,it's no problem.