當你看過IMAP協議以後,就知道很多事情是無能為力,如果是POP3,更是無能為力

解决方案 »

  1.   

    IMAP 和 POP3 是2個接收郵件的協議,除了這2個還是個是新聞接收的協議,名字忘了想要知道收到邮件后的处理等等操作,基本都不支持結論是單純用這些協議是沒辦法
      

  2.   

    javamail 的 InternetAddress 只能判断 emails地址是否 符合rfc822。存不存在是邮件服务器端的问题
      

  3.   


    import java.util.Properties; import javax.mail.*; import javax.mail.internet.*; import com.test.sendToUser; import com.test.sendToUser.*; public class sendMail1 { public static void main(String[] ags)throws Exception { String host = "smtp.sina.com"; // 发件人使用发邮件的电子信箱服务器  String from = "[email protected]"; //"图档管理系统"; 发邮件的出发地(发件人的信箱)  String to = "[email protected]"; // 发邮件的目的地(收件人信箱) // Get system properties  Properties props = System.getProperties(); // Setup mail server  props.put("mail.smtp.host", host); // Get session  props.put("mail.smtp.auth", "true"); Session session = Session.getDefaultInstance(props, new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication( "photomanage", "********"); } }); session.setDebug(true); // Define message  MimeMessage message = new MimeMessage(session); // Set the from address //message.setFrom(new InternetAddress(MimeUtility.encodeText(from)));  message.setFrom(new InternetAddress(from)); // Set the to address  message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); // Set the subject  message.setSubject("找回密码"); // Set the content // message.setText("欢迎你!");  message.saveChanges(); Transport.send(message); } }