简体   繁体   English

如何以编程方式将Yahoo邮件发送到Android应用

[英]How to get yahoo mails in to Android app programmatically

I want to show all yahoomail mails in my android app. 我想在我的Android应用程序中显示所有yahoomail邮件。 Using Imap is it possible? 是否可以使用Imap? Does Imap supports yahoomail? Imap是否支持yahoomail?

Following is the code I tried. 以下是我尝试的代码。

following is the code to get yahoomails 以下是获取yahoomails的代码

public void getYahooMails(View V) throws MessagingException {

    try {

        store = imapSession.getStore("imaps");

        store.connect("imap.mail.yahoo.com", "username", "password");
        System.out.println("*******Message here********"
                + store.isConnected());
        if (store.isConnected()) {
            inbox = store.getFolder("Inbox");
            inbox.open(Folder.READ_ONLY);
            Message[] result = inbox.getMessages();
            System.out.println(result.length + "======"
                    + inbox.getUnreadMessageCount());

            /*
             * for(int i=result.length;i>0;i--) { if(i==1000) {
             * System.out.println
             * (result[i].getSubject()+"=====mesaage ====>"
             * +result[i].getSentDate()); } }
             */

        }
    } catch (Exception w) {

        // w.printStackTrace();
        System.out.println("*******Message here********"
                + store.isConnected());
        // System.out.println(w.getMessage());
        w.printStackTrace();
    }
}

Maybe you can use the sourcecode of android k9 mail as an example. 也许您可以使用android k9邮件源代码作为示例。

I am using k9 to read my yahoo mails using pop3 protocol . 我正在使用k9使用pop3协议读取我的Yahoo邮件。 I donot know if you can access yahoo via imap. 我不知道您是否可以通过imap访问yahoo。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM