使用JavaMail编程,使用新浪的服务器发送邮件,结果提示错误如下:
DEBUG: setDebug: JavaMail version 1.4.3
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.sina.com", port 25, isSSL false
220 irxd5-203.sinamail.sina.com.cn ESMTP
DEBUG SMTP: connected to host "smtp.sina.com", port: 25EHLO 
501 #5.0.0 EHLO requires domain address
HELO 
250 irxd5-203.sinamail.sina.com.cn
DEBUG SMTP: use8bit false
MAIL FROM:<[email protected]>
530 Authentication required
DEBUG SMTP: got response code 530, with response: 530 Authentication requiredRSET
250 reset各位大虾帮帮我

解决方案 »

  1.   

    sina.com 默认是不能通过其它 的客户端连接的如果你想连接那么要在邮件设置那里。设置好! 可以能过foxmail 等连接就行了!
      

  2.   

    我都设置了,用outlook可以连接的
      

  3.   

    你首先得想办法能连接smpt服务器。这个问题在这里很难得到答案。
    你可以通过用telnet 试下看能不能telnet到 smtp服务器上,
    在看看你的25端口是否被屏蔽掉,你电脑上或者局域网上===
      

  4.   

    530 Authentication required!安全验证! Transport.connect(hostName,port,userName,password)确认连接时有写用户名和密码                    /*
     * 必须将mail.smtp.auth属性设置为true,SMTPTransport对象才会向
     * SMTP服务器提交用户认证信息,这个信息可以从JavaMail的javadocs文档
     * 中的com.sun.mail.smtp包的帮助页面内查看到。
     */ props.setProperty("mail.smtp.auth", "true");创建session对象的时候 properties !先测试是否能连接到服务器的 smtpServer !如果能连上了,应该没有问题了。边不上。查看上面的地方。!1: 连接时参数有没少
    2:  有没有设好props.setProperty("mail.smtp.auth", "true");
    差不多了。
      

  5.   


    <%@ page language="java" import="java.util.*,javax.mail.internet.*,javax.mail.*" pageEncoding="GB18030"%>
    <%request.setCharacterEncoding("gbk"); %>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>发送邮件结果</title>
        
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->  </head>
      
      <body>
      <%
      try{
      String to_mail = request.getParameter("to");
      String to_title = request.getParameter("title");
      String to_content = request.getParameter("content");
      
      //建立邮件会话
      Properties props = new Properties();//也可用Properties props = System.getProperties(); 
      props.put("mail.smtp.host","smtp.sina.com");//存储发送邮件服务器的信息
      props.put("mail.smtp.auth","true");//同时通过验证
      Session s = Session.getDefaultInstance(props);//根据属性新建一个邮件会话
      s.setDebug(true);
      
    //由邮件会话新建一个消息对象
    MimeMessage message = new MimeMessage(s);//由邮件会话新建一个消息对象
    //设置邮件
    InternetAddress from = new InternetAddress("[email protected]");
    message.setFrom(from);//设置发件人
    InternetAddress to = new InternetAddress(to_mail);
    message.setRecipient(Message.RecipientType.TO,to);//设置收件人,并设置其接收类型为TO
    message.setSubject(to_title);//设置主题
    message.setText(to_content);//设置信件内容
    message.setSentDate(new Date());//设置发信时间

    //发送邮件
    message.saveChanges();//存储邮件信息
    Transport transport = s.getTransport("smtp");
    //以smtp方式登录邮箱,第一个参数是发送邮件用的邮件服务器SMTP地址,第二个参数为用户名,第三个参数为密码
    transport.connect("smtp.sina.com","tougao","8807693");
    transport.sendMessage(message,message.getAllRecipients());//发送邮件,其中第二个参数是所有已设好的收件人地址
    transport.close();
      %>
      <div align="center">
      <p>发送成功!</p>
      </div>
      <%
      }catch(MessagingException e){
      out.println("发送失败!");
      }
      %>
      </body>
    </html>
    新浪的POP3和SMTP功能都开通了,可还是不行啊