I have asked this question earlier in
jboss section and also on
jboss website. But I was wrong in posting my query. The solution that I got was
jBoss specific. But my requirement needs me to send the mail without using the jBoss mail service. So I'm posting this again. I want to send the mail using simple
java mail API. I can't use jBoss services. This is the code that I'm using
Now the problem is that when the tr.connect method is called, I get a messaging connection. I am connecting to localhost as you can see. I was told to use JES for sending the mail. I also found that the username and password is not needed while connecting when using JES. But I'm not able to make this work. I changed the code to use the mail server of my company. I used the url of the mail server and the username and password of the mail server. But still I'm getting Messaging Exception. There is nothing wrong with the code as it is working on the live site on which it is actually deployed. So basically I just need to configure JES or any other mail server properly. Can anyone give me an idea or a web resource to make this work.
Also can I use a server like gmail to send the mail using my username and password of gmail. I know this may sound stupid if I'm wrong
...