나는 안드로이드 초보자와 나는이 자습서를 SMTP link another SMTP tutorial안드로이드에서 SMTP를 사용하여 이메일을 보내지 못하셨습니까?
을 따랐다 그러나 불행하게도 내가 에뮬레이터/장치 S3, 나는 "CATCH"블록 메시지를 얻고하려고 할 때마다 이메일을 보내지 못했습니다. 이 활동에서 확장 클래스는
ImageView submitBtn = (ImageView)findViewById(R.id.askscreen_submit_btn);
submitBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
try {
// CALL GetText method to make post method call
m = new Mail("[email protected]","password");
sendEmail(v);
} catch (Exception ex) {
content.setText(" url exeption! ");
}
}
});
}
public void sendEmail(View view){
String[] toArr = {"[email protected]"}; // This is an array, you can add more emails, just separate them with a coma
m.setTo(toArr); // load array to setTo function
m.setFrom("[email protected]"); // who is sending the email
m.setSubject("subject");
m.setBody("your message goes here");
try {
//m.addAttachment("/sdcard/myPicture.jpg"); // path to file you want to attach
if(m.send()) {
// success
Toast.makeText(AskfatwaActivity.this, "Email was sent successfully.", Toast.LENGTH_LONG).show();
} else {
// failure
Toast.makeText(AskfatwaActivity.this, "Email was not sent.", Toast.LENGTH_LONG).show();
}
} catch(Exception e) {
// some other problem
Toast.makeText(AskfatwaActivity.this, "There was a problem sending the email.", Toast.LENGTH_LONG).show();
}
}
누군가가 이유가 무엇인지 좀 도와 주시겠습니까?
전자 메일 api를 사용 하시겠습니까? –
나는 또한이 튜토리얼을 따라 갔다. http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_%28no_Intents%29_in_Android – user3233280
나는 위에서 언급 한 튜토리얼을 따라 몇 가지 중 하나는 나를 도울 수있다 – user3233280