• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Problem regarding JavaMail

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am trying to write a simple Java application to send a mail using java mail api. I want to use my computer as an smtp host.

The code is as under :



I am getting the following exception :


javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1611)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
at javax.mail.Service.connect(Service.java:288)
at javax.mail.Service.connect(Service.java:169)
at javax.mail.Service.connect(Service.java:118)
at javax.mail.Transport.send0(Transport.java:188)
at javax.mail.Transport.send(Transport.java:118)
at com.javamail.example.SMTPClient$SendAction$1.run(SMTPClient.java:102)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1589)
... 9 more



Please help me as i am unable to solve the problem. Thanks in advance.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you running a mail server on this machine? Without one you can't send mail. If you don't have one yet, Apache James is a open source Java mail server you could use.
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf,
I have now installed Apache James. Now when I run my program nothing comes, no error , no exception and the mail also dosen't come . Please Help me
 
Sheriff
Posts: 28370
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you use JavaMail to send an e-mail, and you don't get any exceptions but the e-mail doesn't arrive, the next step is to ask the administrator of the SMTP server to investigate.

In this case, that administrator is you. You will have to see what logging James does. It's quite possible you have configured it incorrectly. It might not have a connection to the Internet, or you might have set it up in such a way that other servers won't talk to it. Anything is possible. I recall that it comes with how-to documentation but it's a few years since I looked at it.

If you don't want to become an administrator, perhaps you should find another server you can use. Then you can ask its administrator to deal with this sort of problem.
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am connected to the internet when I run my mail program. When I setup the account with Mozilla Thunderbird then its working and I am able to send and receive mails. One important thing when I am trying to send mail to my gmail account or yahoo account using Thunderbird then also the mail dosen't go. Why is this happening ?. But I am not able to do the same thing using my SMTP client program. I am not able to understand where I am going wrong.
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Following is the log which I am getting in apache james mail server.

mailet-2008-03-10-09-24.log



dnsserver-2008-03-10-09-24.log



Please Help me and guide me where I am going wrong.
Thanks in advance.
 
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic