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 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.
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:
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.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop