2016-08-18 7 views
0

나는 응용 프로그램은 특정 메일 ID로 메일 배경을 보내는 암호 시간을 잊었 하나의 응용 프로그램을 만드는 중이라서. 그것은 다른 메일에 Gmail을 작동하고 (또한 Gmail을 포함한다)하지만 우리의 클라이언트 (예 메일을 보내는 배경을 사용하여 [email protected])은 내가 여러 번 보내지 한 메일 시도 가능하지만 로그 캣에서 하나의 오류 메시지가 다른 메일 클라이언트 도메인 ID가 필요Android에서 gmail 호스트가 아닌 다른 호스트를 사용하여 백그라운드에서 메일을 보내는 방법은 무엇입니까?

javax.mail.AuthenticationFailedException link used in browser that time display warning

답변

0
public class SendMessageService extends Service{ 
    public void sendMessage(){ 
    Intent send = new Intent(Intent.ACTION_SENDTO); 
    String uriText = "mailto:" + Uri.encode("[email protected]") + 
     "?subject=" + Uri.encode("the subject") + 
     "&body=" + Uri.encode("the body of the message"); 
    Uri uri = Uri.parse(uriText); 
    send.setData(uri); 
    startActivity(Intent.createChooser(send, "Send mail...")); 
    } 
} 

는 약 here를 읽을 수 있습니다 당신이 서비스에 대해 알아야 할 몇 가지 주요 사항이 있습니다. 이 코드의 대부분은 this example에서 가져 왔지만 필요에 맞게 맞춤 설정할 수 있어야합니다.


편집 1 :

이것은 또한 this question의 중복 될 수 있지만 몇 가지 차이점이 있습니다.