2014-02-06 68 views
0

有沒有一種方法來驗證用戶的電子郵件地址和密碼,在Android中使用javamail api而無需向他們發送電子郵件..到目前爲止,這是我的代碼,它不似乎解決任何問題..如何驗證用戶登錄使用Android中的javamail api android

btn_login.setOnClickListener(new OnClickListener() { 

     @Override 
     public void onClick(View arg0) { 


        Authenticator authenticator = new Authenticator() { 
        private PasswordAuthentication authentication; 
        { 
        authentication = new PasswordAuthentication("username", "password"); 
        if(authentication != null){ 
         Toast.makeText(getApplicationContext(), "Successful Login", Toast.LENGTH_LONG).show(); 
        }else{ 
        Toast.makeText(getApplicationContext(), "incorrect Password", Toast.LENGTH_LONG).show(); 
        } 
        } 
        protected PasswordAuthentication getPasswordAuthentication() { 
        return authentication; 
        } 
        }; 

或較好地解決了這個人,我很渴望聽到,感謝

回答

0

連接到服務器,然後斷開沒有做任何事情。請參閱Store.connect和Transport.connect方法。

+0

正是我需要做的,謝謝 –