通过java中的IMAPS从Microsoft Exchange Server 2007中提取邮件

时间:2010-06-17 09:25:06

标签: java email

props.put(“mail.debug”,“true”);   props.setProperty( “mail.store.protocol”, “IMAPS”); props.setProperty( “mail.imaps.auth.plain.disable”, “假”); props.setProperty( “mail.imaps.host”, “Mail3.connect.com”); props.setProperty( “mail.imaps.port”, “135”); props.setProperty( “mail.imaps.user”, “测试”); props.setProperty( “mail.imaps.pwd”, “123”); props.setProperty( “mail.imaps.ssl.protocols”, “SSL”); props.setProperty(“mail.imaps.socketFactory.class”,“javax.net.ssl.SSLSocketFactory”); props.setProperty(“mail.imaps.socketFactory.fallback”,“false”); props.setProperty(“mail.imaps.socketFactory.port”,“135”);

我已经完成了所有这些,但它仍然说 javax.mail.AuthenticationFailedException:连接失败,没有指定密码?

请帮助我 感谢


我还使用以下代码建立连接但全部都在垃圾箱中

import java.util.Properties; import javax.mail。*;

公共类TestSSL {

/**
 * @param args
 */
public static void main(String[] args) {

            Properties props = System.getProperties();          
        props.put("mail.imaps.auth.plain.disable","true"); 
            try {
                Session session = Session.getDefaultInstance(props, null);
                session.setDebug(true);
                Store store = session.getStore("imaps");
                store.connect("host", 993, "username", "password");
                System.out.println(store);
                Folder inbox = store.getFolder("Inbox");
                inbox.open(Folder.READ_ONLY);
                Message messages[] = inbox.getMessages();
                for(Message message:messages) {
                    System.out.println(message);
                }
        }  catch (Exception e) {
            e.printStackTrace();
            System.exit(2);
        }

}

pllllllllllzzzzzzzzzzzzzzzz帮助

1 个答案:

答案 0 :(得分:0)

尝试使用Apache JAMES来解决您的问题。让我们知道它是如何运作的。最好的运气。再见