Link to home
Start Free TrialLog in
Avatar of bganoush
bganoush

asked on

JavaMail stopped working... with Software caused connection abort: connect


Hello World!

I have been using JavaMail in my application for a while and until last month it has been working great.  Now all I get is a MessageException every time my app tries to send()...

Here is the main emailing code:

private void sendReport()
{
      try
      {  
            Properties props = System.getProperties();
            props.put("mail.smtp.host", m_SMTPServer);

            Session session = Session.getDefaultInstance(props, null);
            session.setDebug(true);

            Message msg = new MimeMessage(session);
            msg.setFrom(new InternetAddress(m_From));
            msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(m_To, false));
            msg.setSubject(m_Subject);
            msg.setHeader("X-Mailer", "MyApplicationName");
            msg.setSentDate(new Date());

            //msg.setText(getBody());
            //msg.setText("Test Message");
            msg.setContent("Test Message", "text/plain");

            Transport.send(msg);
      }
      catch (Exception e)
      {
            ErrorLog eLog = new ErrorLog(m_Config);
            eLog.log("Report Error: Caught exception trying to send email: " + e.getMessage());
      }
}


Here is the exact error message and a stack dump:

      Report Error: Caught exception trying to send email: Could not connect to SMTP host: my-relay-server-was-here, port: 25;
 nested exception is:
            java.net.SocketException: Software caused connection abort: connect

Stack Dump:

javax.mail.MessagingException: Could not connect to SMTP host: my-relay-server-was-here, port: 25;
  nested exception is:
      java.net.SocketException: Software caused connection abort: connect
      at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1227)
      at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:322)
      at javax.mail.Service.connect(Service.java:236)
      at javax.mail.Service.connect(Service.java:137)
      at javax.mail.Service.connect(Service.java:86)
      at javax.mail.Transport.send0(Transport.java:150)
      at javax.mail.Transport.send(Transport.java:80)
      at myApp.sendReport(MyThread.java:125)
      at myApp.run(MyThread.java:190)


When I turn debugging on "session.setDebug(true)", I get this:

DEBUG: setDebug: JavaMail version 1.3.3
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "my-relay-server-was-here", port 25, isSSL false



Anyone have any idea what could be going wrong and how to fix it?

-- Bubba

Avatar of laes_
laes_

Avatar of bganoush

ASKER


Why are you giving me these links? Don't you think I already looked at them?

The second one is a low level email sample that doesn't use JavaMail... The first is just a FAQ that I looked over as much as I could but still didn't find any answers....

-- Bubba
are you sure your relay changed it's policy?
Now it need authentication, for example.

Well... I know for sure that authentication is not needed because I use the same settings in Outlook...  But just in case, how do you specify authentication?
ASKER CERTIFIED SOLUTION
Avatar of Giant2
Giant2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CEHJ
>>
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "my-relay-server-was-here", port 25, isSSL false
>>

What comes after this? Have you now tried authenticating?

Ok,

Actually nothing comes after it...

But I found the problem. McAfee.

One of the IT guys came in here and installed an enterprise version of McAfee with policies for the entire company. The problem is that this is a server, not an end-user station.  By doing this, a spam blocking system within McAfee stops all emails from going out.

Well thanks Giant... The links didn't work but I was able to locate some hints in that link.

-- Bubba
happy your solved.
tx accepting.