我刚刚注册的一个  sina 的邮箱。
想要实现发送邮件的功能, 可是一直都连接不上,
代码如下:
  try {
       Properties props = new Properties();
      props.put("mail.smtp.host", mailserver); 
      props.put("mail.smtp.auth", "true"); 
      Session session = Session.getDefaultInstance(props,
          new Authenticator() {
        public PasswordAuthentication getPasswordAuthentication() {
          return new PasswordAuthentication(user, password);
        }
      }
      );
      Message msg = new MimeMessage(session);
      msg.setFrom(new InternetAddress(fromAddr));
      InternetAddress[] tos = InternetAddress.parse(toAddr);
      msg.setRecipients(Message.RecipientType.TO, tos);
      msg.setSubject(subject);
      Transport.send(msg);
      System.out.println("Mail is Sent");
    }
    catch (Exception e) {
      System.out.println(e);
    }  }

解决方案 »

  1.   

    foxmail    注册复杂   还要下软件  我用的不是中文系统    那个还要发短信  怕是给乱扣费了
      

  2.   

     前些天写过一个关于JAVAMAIL的东西,贴上部分代码,希望对lz有点用^_^
                    .........
                    String POP3server = "pop.163.com";
    String SMTPserver = "smtp.163.com";
    Session mailsession = null;
    Store store;
    Folder folder;
    Message[] messages = null;
    final String username;
    final String password;


    username = request.getParameter("user");
    password = request.getParameter("password");

    java.util.Properties properties = System.getProperties();
    properties.put("mail.smtp.host", SMTPserver);
    properties.put("mail.smtp.auth", "true");
                    .........
      

  3.   

    非常感谢 
    我试过163  的了  不好使阿  我的那个既不是付费的 也不是vip
    我就想找一个支持smtp的邮箱  一直找不到真愁人
      

  4.   

    com.sun.mail.smtp.SMTPSendFailedException: 553 You are not authorized to send mail, authentication is required
    这是运行之后那条错误信息
      

  5.   

    sorry,没有收到你的邮件,不过从你上面的提示信息看,服务器需要认证。而且你也可以上网去看看553错误的时候,还会有哪些可能的错误,有时候也可能是你机器中毒了,服务器拒绝发送信件。//创建认证实例
    mailsession = Session.getInstance(properties, new Authenticator() {
     public PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(username, password);
     }
                   });
      

  6.   

    我感觉就是我的这个邮箱是普通邮箱的问题   因为这两天也查了网上的一些说挺多都不支持smtp