哦, 我可以给你esmtp server地址 ==> utstar.hz.zj.cn
只要用javamail附带的demo目录下的msgsend.java试试就可以了

解决方案 »

  1.   

    首先,5字头的错误可能是程序错误了,再看看你的程序;其次, 如果对方用的不支持标准的SMTP协议,哪你何必去兼容,如果你一定要去做,你可以去改javaMail里的Transport哪个类了
    重载send的方法,加一个有参数的。我有好久没有用javamail开发了,不过我记得Transport这个类在调用send方法前是可以设置的,其实只要用SMTP协议,自己按照它的范式些个程序也很简单了
      

  2.   

    首先, 我用了telekbird的smtp server, 程序正常; 其次, 我发的就是我们公司的smtp server, 是商用的, 公司不会用不支持标准的smtp协议的服务器来开玩笑. 所以,明显是javamail1.2没有跟上步伐, 或者是我没有发现改设置的地方.
    所以只有我该程序去适应它, 但如果我能找到这个地方, 我就不会拿来问了, 因为我看了所有的javamail的api doc, 没有像改HELO指令带什么参数的. 
    其实, 只要你拿着C, 你可以些个java出来, 又何必用别人的java呢.
      

  3.   

    另外, Transport的send方法如果封装了HELO指令(private), 你重载了也没用. 加一个有参数的, 和重写没什么区别.
      

  4.   

    我是想说你可以去改Transport的源码了,还有,你可以把你的smtp的ip加在hosts文件里,对了你的系统是linux还是nt
      

  5.   

    呵呵, 没错, 我第一想到的就是改Transport的源码, 可惜javamail1.2还未提供源码.
    smtp address是否放在hosts文件里和我这个问题没有关系.
    我的系统是linux, redhat.
      

  6.   

    Had the same thing when I switched from NT to Linux. Seems the
    501 HELO error was a symptom of something else (at least for
    me). When I looked in the error logs I found a number of Java
    Bind Exceptions. These were due to some defunct Java processes
    hanging around from some previous invocations. I assume you're
    using Apache + Jserv or similar? Try running the following
    commands/etc/rc.d/init.d/httpd stop (stops apache)
    ps -ef | grep java (look for defunct processes)
    kill -9 xxxx (where xxxx is the process ID of ANY
    running java process from ps command: - kill them all!)
    /etc/rc.d/init.d/httpd start (starts apache again)The above worked for me. Note that restarting the box would have
    had the same effect, which you have probably done by now,
    anyway...
     
     
      
      

  7.   

    ESMTP Server可以接受不加参数的HELO命令啊……你的问题应该不在这个地方吧……
      

  8.   

    刚试了试,你们的ESMTP服务器确实要加参数才行……不过MS的是不用的……
      

  9.   

    To ender: It maybe can accept instruction without parameter.
    But I think our company's ESMTP must be set up to rejuct non-parameter instruction.To kuqi: your suggestion indicates that restarting the http server maybe give some help. But I think it's no help. I can sure that it ESMTP server's problem, because I telnet to my server, port 25, and write HELO command directly, It also responds to me 501 XXXX......
    So the ESMTP server must require the instruction HELO with some parameters.That's all. Thanks.
      

  10.   

    The SMTP provider uses the results of InetAddress.getLocalHost().getHostName() in the SMTP HELO command. If that call fails to return any data, no name is sent in the HELO command. Check your JDK and name server configuration to ensure that that call returns the correct data. Starting with JavaMail 1.1.3, you may also set the mail.smtp.localhost property to the name you want to use for the HELO command. 
      

  11.   

    JavaMail will pick this address up by default
      

  12.   

    http://www.csdn.net/develop/library/java/Servlets_JSP/525.shtm
      

  13.   

    Ok. Maybe it works. I'll try it. 
    Wait a little bit.
      

  14.   

    http://www.csdn.net/develop/read_article.asp?id=7132
      

  15.   

    hah. It's exactly I wanted.
    Kuqi, thank u for you warm-hearted help. I'll give my point to u. Can u introduce urself briefly? I make a decision to immigate to Canada and now is in process. Please feel free to contact with me. Also thanks to other peoples who help me a lot.
      

  16.   

    Why I cannot give the point? help me.