• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Email from jBoss

 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all this is not for the book. This is a real query. I have seen a lot of posts which seems to be fabricated for winning the book. But this is a real problem.

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



Now it gives an exception when the connect method is called

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...
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone has some idea :roll:
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have much experience with mail related configurations on JBoss. But the code that you posted doesn't look like JBoss specific. Are you following some tutorial or any other document where you got that from? And from what i remember, there was a chapter on mailing in some JBoss doc. Let me see if i can find it.
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well after some research I have found that I can send email from my java application in two ways.

1. Use the OS SMPT service and send the mail which I am doing
2. Use jBoss to connect to a specific server to send the mail. For that you have to use the mail-service.xml file along with the jBoss email bean.

I am using the first one on Windows XP and the SMTP service on my windows XP is running. I used netstat -abno on command line to view all the ports which are listening but 25 port is not on the list. So I tried the second approach. But I got an exception as in the mail-service.xml file the emailing server was not configured. It was set to smtp.nosuchhost.nosuchdomain.com. So is there any server which I can use to send my mail.

I am really stuck at this so really looking for some help :roll:
 
mohamed sulibi
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi;

actually i don't know the solution in JBossAS, but i think you use the email service that the AS provide as you use the DataSource instance, so
you can configure the parameters for your mail server that you use to send the email, and then get the JNDI context to mail session.


but as i told i don't know.

Best Regards.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic