title: Java Mail mystery - SMTP blocked?
body: <p>I have a Java program which uses javax.mail to send an SMTP message.   This program works fine on a Linux box, I want to emphasize that beforehand.  When I try this same code on my Windows 7 x64 box, I get this error:</p>
  
  <pre><code>send failed, exception: javax.mail.MessagingException: Could not connect to SMTP host:     smtp.west.cox.net, port: 25;
  nested exception is:  java.net.SocketException: Network is unreachable: connect
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>Session session = Session.getInstance(props, null);
  MimeMessage msg = new MimeMessage(session);
  msg.setFrom();
  msg.setRecipients(Message.RecipientType.TO, props.getProperty("mail.to", "me@mine.com"));
  msg.setSubject(mySubject);
  msg.setSentDate(new Date());
  msg.setContent(sBuf.toString(), "text/html");
  Transport.send(msg);
  </code></pre>
  
  <p>This program pretty much uses defaults for everything.  It works fine on another box on the same network. It uses the same settings that I use for my regular mail client, which works fine. There is something on THIS Windows box that is blocking SMTP, but only for Java.</p>
  
  <p>I have Symantec (Norton) 360 installed. Turning it off makes no difference, but rebooting into Safe Mode (which disables almost everything) allows the program to work and send mail just fine.  </p>
  
  <p>So, to recap:</p>
  
  <ol>
  <li>The program code works.</li>
  <li>The settings are correct. </li>
  <li>SMTP works for Windows Mail and is only blocked for Java on this Windows machine.</li>
  </ol>
  
  <p>Before I spend another day tearing things apart and uninstalling / reinstalling, I wondered if anyone had any advice on fixing this?</p>