[jboss-user] [Beginners Corner] - Problem with sending Email from jBoss

ankitgarg do-not-reply at jboss.com
Wed Jan 21 02:33:08 EST 2009


I want to know how to send mails from jBoss. A google search revealed something which confused me. It said that mail sending is done through a bean java:/email or something. This confused me. I am using javax.mail.Transport to send the mail. The code is like this 

Properties props = new Properties();
  | Session mailConnection = Session.getInstance(props, null);
  | Transport tr = mailConnection.getTransport("smtp");
  | tr.connect("127.0.0.1","username","pass");

Now it gives an exception when when the connect method is called as-

javax.mail.MessagingException: Could not connect to SMTP host: 127.0.0.1, port: 25;
nested exception is:
      java.net.SocketException: Software caused connection abort: connect

Now there are a few things I am not sure of. First of all I think the username and password given when calling connect method are those defined in the mail-service.xml in jBoss. Also is mailing on directly in jBoss or do I have to start it by configuring it.

I would be thankful to anyone who could help...

(I have also posted this on coderanch.com but not getting any reply there so cross posted it here)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203497#4203497

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203497



More information about the jboss-user mailing list