• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Mail exception

 
Michael Brewer
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what this exception means exactly.
javax.mail.MessagingException: Could not connect to SMTP host: fooserver, port: 25; nested exception is: java.net.ConnectException: Connection refused: connect

It looks like the nested exception is getting cut-off for some reason. I tried catching it separately, but javac said that ConnectException was not being thrown so I had to remove it.
Can someone more experienced with javax.mail or java.net give me a helpful pointer?
[ November 15, 2002: Message edited by: Michael Brewer ]
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well.. aside from the fact that a mail server probably wouldn't be "fooserver" ?

You'd be looking for your ISP's email server there... something like smtp.your_isp_name_here.com

As for JavaMail being quiet about the 'root' exception.. I've noticed that before. I'm not sure if there's a way to get more verbose messages from JavaMail. When I really think of it though.. most javamail / net exceptions probably don't NEED to be very verbose. It's mostly a configuration error that is to blame, and well.. it's kinda self-evident in most cases.

"connection refused". means fooserver on port 25 isn't answering your hail.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As long as fooserver is not your peoblem It could be also that your SMTP server requires Authentication. Therefor you would need to supply a username and password to access the SMTP server.
Here is a link to the JGuru Java Mail tutorial that talks about the Authenticator and how to use it. Hope that helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!