Transport transport = s.getTransport("smtp");    //注意是smtp服务器
transport.connect("smtp.mail.yahoo.com","anyvote","123456");
transport.sendMessage(message,message.getAllRecipients());
transport.close();替换:
Store store = s.getStore("pop3");
store.connect("pop.mail.yahoo.com","anyvote","123456");Transport.send(message);store.close();

解决方案 »

  1.   

    还不行啊。
    报错:javax.servlet.ServletException: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html接着,我在props.put("mail.smtp.host","smtp.mail.yahoo.com");前添加了一句:
    props.put("mail.smtp.auth","true");结果,报错:
    StandardWrapperValve[debugjsp]: Servlet.service() for servlet debugjsp threw exceptionjavax.servlet.ServletException请指教!!
      

  2.   

    换个信箱试一下。yahoo好像不支持pop连接的。
      

  3.   

    那么客户端软件(如:HOTMAIL)怎么接受YAHOO的邮件呢?
      

  4.   

    javax.servlet.ServletException: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.htmlAuthentication needed.
    You must add your mail account authentication information
    props = new Properties();
    props.put("mail.smtp.host", "smtp.mail.yahoo.com");
    props.setProperty("mail.transport.protocol","smtp");
    props.setProperty("mail.smtp.auth","true");
    session = Session.getInstance(props, new Authenticator() {
        protected PasswordAuthentication getPasswordAuthentication() {
             return new PasswordAuthentication(username,password);
             //username is your mail account username, password is your password  
        }
    });
      

  5.   

    bruni(不如你) ,你这段话是不是代替:
    props.put("mail.smtp.host","smtp.mail.yahoo.com");
    Session s = Session.getInstance(props);这样,程序变成:
    <%@ page contentType="text/html; charset=GBK" %>
    <%@ page import="java.util.*,javax.mail.*,javax.mail.internet.*"%>
    <%
    Properties props = new Properties();
    props = new Properties();
    props.put("mail.smtp.host", "smtp.mail.yahoo.com");
    props.setProperty("mail.transport.protocol","smtp");
    props.setProperty("mail.smtp.auth","true");
    Session s = Session.getInstance(props, new Authenticator() {
        protected PasswordAuthentication getPasswordAuthentication() {
             return new PasswordAuthentication("anyvote","123456");
             //username is your mail account username, password is your password
        }
    });MimeMessage message = new MimeMessage(s);InternetAddress from = new InternetAddress("[email protected]");
    message.setFrom(from);
    InternetAddress to = new InternetAddress("[email protected]");
    message.addRecipient(Message.RecipientType.TO,to);message.setSubject("test mail");
    message.setText("do you see it??");Transport transport = s.getTransport("smtp");    //注意是smtp服务器
    transport.connect("smtp.mail.yahoo.com","anyvote","123456");
    transport.sendMessage(message,message.getAllRecipients());
    transport.close();
    %>
    <html>
    <head>
    <title>
    index
    </title>
    </head>但是,还是报错:
    StandardWrapperValve[debugjsp]: Servlet.service() for servlet debugjsp threw exceptionjavax.servlet.ServletException
    看来,用YAHOO的STMP不能发MAIL.
    </html>
      

  6.   

    Transport transport = s.getTransport("smtp");    //注意是smtp服务器
    transport.connect("smtp.mail.yahoo.com","anyvote","123456");
    transport.sendMessage(message,message.getAllRecipients());
    transport.close();-->Transport.send(message);
      

  7.   

    就是smtp的问题,你只要设正确smtp就一定没有问题
      

  8.   

    netos() ,什么叫免STMP??
    是不是不用STMP?
      

  9.   

    bruni(不如你),代码如下,但还报错:
    javax.servlet.ServletException: Sending failed;
      nested exception is: 
    javax.mail.AuthenticationFailedException
    同时,我的YAHOO邮箱中收到一封YAHOO的信,意思说要使用POP,要交钱代码:
    <%@ page contentType="text/html; charset=GBK" %>
    <%@ page import="java.util.*,javax.mail.*,javax.mail.internet.*"%>
    <%
    Properties props = new Properties();
    props = new Properties();
    props.put("mail.smtp.host", "smtp.mail.yahoo.com");
    props.setProperty("mail.transport.protocol","smtp");
    props.setProperty("mail.smtp.auth","true");
    Session s = Session.getInstance(props, new Authenticator() {
        protected PasswordAuthentication getPasswordAuthentication() {
             return new PasswordAuthentication("anyvote","123456");
             //username is your mail account username, password is your password
        }
    });MimeMessage message = new MimeMessage(s);InternetAddress from = new InternetAddress("[email protected]");
    message.setFrom(from);
    InternetAddress to = new InternetAddress("[email protected]");
    message.addRecipient(Message.RecipientType.TO,to);message.setSubject("test mail");
    message.setText("do you see it??");Transport.send(message);%>
    <html>
    <head>
    <title>
    index
    </title>
    </head>
      

  10.   

    javax.mail.AuthenticationFailedException是不是用"[email protected]"作为用户名来登陆邮件服务器试试?
      

  11.   

    你把session.setDebug(true);看看后台输出什么?
      

  12.   

    http://help.yahoo.com/help/gb/mail/mail-01.html
    是否能用其它电子邮件客户端程序(如 Netscape、Eudora 或 Outlook)来发送和阅读雅虎中国的电邮? 
    作为一种基于 web 的电子邮件服务,雅虎中国目前不提供对 POP 或者 SMTP 服务器的访问。这意味着您不能用外部电子邮件客户端程序(例如 Netscape Mail、Eudora 或 Outlook)来访问您的雅虎中国的电邮帐户。