خرید بک لینک

Vote count: 0

i am trying to coonect to my mail box using the java mail api based on imap protocol. i check and for sure i inserting the correct parameters. this is the following exception that i got:

[ALERT] Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)

i do not know why it is happens in addition i enabled the imap option in my gmail account settings.

this is my code:

Properties protocol = new Properties();
                protocol.setProperty("mail.store.protocol", "imaps");
                try{
                    Session session = Session.getInstance(protocol, null);
                    Store store = session.getStore();
                    String host = prop.getProperty("host");
                    String email = prop.getProperty("useame");
                    String password = prop.getProperty("password");
                    store.coect(host, email, password);
                    Folder inbox = store.getFolder("INBOX");
                    inbox.open(Folder.READ_ONLY);
                    int messageCount = inbox.getMessageCount();
                    model.addAttribute("msg","number of mails"+" "+messageCount);
                    Message[] messages = inbox.getMessages();
                    PrintWriter writer = new PrintWriter(useame+".txt", "UTF-8");
                    for(int i=0;i<messageCount || prop.getProperty("status").equals(status.RUNNING.toString()) ;i++ ){
                        model.addAttribute("msg","Reading Mails");
                        Multipart mp = (Multipart) messages[i].getContent();
                        BodyPart bp = mp.getBodyPart(0);
                        writer.println("From:"+ messages[i].getFrom()+" "+"Subject:"+messages[i].getSubject()+" "+"Message:"+bp.getContent());
                        prop =  loadProperties(useame+".properties");
                    }
                    writer.close();
                    inbox.close(true);
                    store.close();

                }catch (Exception e){
                    model.addAttribute("msg","Exception:"+e.getMessage());
                }

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: شنبه 24 بهمن 1394 ساعت: 14:15

صفحه بندی