props.put("mail.pop3.auth","true"); //这行一定要有改成:props.put("mail.smtp.auth","true"); //这行一定要有

解决方案 »

  1.   

    还是不行,本来是props.put("mail.smtp.auth","true"); 我改程序时忘改过来了。
    javax.mail.SendFailedException: Sending failed;
      nested exception is:
    class javax.mail.AuthenticationFailedException at javax.mail.Transport.send0(Transport.java:218) at javax.mail.Transport.send(Transport.java:80) at webmail.mymail.main(mymail.java:54)就是不行,气死我了!
      

  2.   


    还有一点,发信人的地址应该与验证人的地址是一致的。也就是你用zmrjl验证,就要用它作为发信人的地址[email protected]才行。
      

  3.   

    用163 ,yeah 发信需要用户验证的
      

  4.   

    还是不行,哪位热心人帮帮我写个调试好的发邮件的程序 从[email protected]发送到[email protected] 验证的用户密码看上面的程序 谢谢了!
      

  5.   

    static class MyAuthenticator extends Authenticator {
        protected PasswordAuthentication getPasswordAuthentication() {
          return new PasswordAuthentication ("wen-jian", "");
        }
      }
      public static void send(String smtpServer, String to, String from
       , String subject, String body)
      {
        SimpleSender SimpleSender1 = new SimpleSender();
        try
        {
          Properties props = System.getProperties();      // -- Attaching to default Session, or we could start a new one --      props.put("mail.smtp.host", smtpServer);
          props.put("mail.smtp.auth","true");      MyAuthenticator auth = new MyAuthenticator();      Session session = Session.getDefaultInstance(props,auth);      // -- Create a new message --
          Message msg = new MimeMessage(session);      // -- Set the FROM and TO fields --
          msg.setFrom(new InternetAddress(from));
          msg.setRecipients(Message.RecipientType.TO,
            InternetAddress.parse(to, false));      // -- We could include CC recipients too --
          // if (cc != null)
          // msg.setRecipients(Message.RecipientType.CC
          // ,InternetAddress.parse(cc, false));      // -- Set the subject and body text --
          msg.setSubject(subject);
          msg.setText(body);      // -- Set some other header information --
          msg.setHeader("X-Mailer", "LOTONtechEmail");
          msg.setSentDate(new Date());      // -- Send the message --
          Transport transport = session.getTransport("smtp");
          Transport.send(msg);      System.out.println("Message sent OK.");      Store store = session.getStore("pop3");
          store.connect("smtp.163.net", "wen-jian","123456");
          Folder folder = store.getFolder("INBOX");
          folder.open(Folder.READ_ONLY);
          Message message[] = folder.getMessages();
          System.out.println(((MimeMessage)message[0]).getContent());
        }
    这个是我试过的
      

  6.   

    props.put("mail.smtp.host", smtpServer);
    smtpServer是什么??
      

  7.   

    而且我的少数基本方法比如:Session.getDefaultInstance根本就不出现方法提示不知道何故
      

  8.   

    props.put("mail.smtp.auth","true"); 
    mymail mm=new mymail("zmrljl","zmrljl");
    你发信的地址是zmrljl吗?
    你发信的地址的密码也是zmrljl吗?
    要人证的话,就需要实际的邮箱用户和密码!
      

  9.   

    163好像也需要SMTP认证的,你找一个不需要认证的邮箱试试看。
      

  10.   

    不能吧,怎么搞的! sharetop(老大不小)怎么可能发出去呢??楼上说163是经过smtp认证的,可是我写认证代码了!
      

  11.   

    是啊,我原来用不认证的试了一下,没问题,又换163,用我自己的信箱来试,成功发到了我公司的信箱中。所以我才跟你说……我的msn:[email protected]这事如果急,可以与我讨论