Java Mail mystery - SMTP blocked?

后端 未结 6 1203
孤城傲影
孤城傲影 2020-12-09 05:40

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 cod

相关标签:
6条回答
  • 2020-12-09 05:42

    I had the same problem during upgrade form java 1.6 to java 1.7. The problem occured because java 1.7 using IPv6 by default. To fix this, you need to add Java Option like on example below.

    Just run this command on Windows cmd:

    setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true
    
    0 讨论(0)
  • 2020-12-09 05:44

    Synantec EP 12.1 RU5 fixes your issue.

    Symantec Endpoint Protection blocks email sent by Java mail client

    Fix ID: 3399185

    Symptom: The Internet Email Auto-Protect feature of Symantec Endpoint Protection blocks SMTP email sent by a Java mail client.

    Solution: Updated the Internet Email Auto-Protect driver to allow processing of IPv4-mapped IPv6 addresses.

    0 讨论(0)
  • 2020-12-09 05:56

    I had similar issue but strangely everything was working fine with jdk 1.6 once I install jdk 1.7 I got the exception. I wonder what could be the reason for this!

    After adding IPV4 argument it is working fine..Thank you so much.

    0 讨论(0)
  • 2020-12-09 05:58

    Although this issue is solved: it might still be useful to point out that some Windows Firewalls block/allow access to ports based on the executable name (rather than purely the port number itself) - so you can end up with one program (say Outlook) being allowed and another (say Java) being blocked.

    0 讨论(0)
  • 2020-12-09 06:02

    The problem is due to the IPv4/IPv6 preference of Java. Java tries to use IPv6 by default (?) and my ISP does not support IPV6. However, it's enabled on my Windows 7 boxes by default.

    If you are experiencing similar behavior, you can verify this by going to "Control Panel/Network and Internet/Network Connections", right-clicking your internet connection, and selecting "Status" from the context menu. The Status dialog will display two lines similar to this:

    IPv4 Connectivity:  Internet
    IPv6 Connectivity:  No Internet access
    

    This is the root of the problem - Java prefers IPv6, which it cannot use to connect to the internet.

    To fix this, do either one (or both) of these things:

    1. Disable IPv6 on your Windows 7 box.
    2. Start your java program using this command line option:

      -Djava.net.preferIPv4Stack=true
      

    Doing either one of these will fix the problem.

    0 讨论(0)
  • 2020-12-09 06:08

    I was also facing the same issue , basically it was a Java 7 issue, Just passing in JVM argument "-Djava.net.preferIPv4Stack=true", i got rid from issue .

    0 讨论(0)
提交回复
热议问题