我正在尝试使用 javax.mail 包从 android 应用程序发送电子邮件,我发现了这一点,它在 premarshmallow 操作系统上运行良好,但是当我尝试从具有 Marshmallow 或更高版本操作系统的手机发送电子邮件时,Transport.send(message)挂起并且从不返回这是我的SendEmailTask课 public static class SendEmailTask extends AsyncTask<Void, Void, Boolean> { @Override protected Boolean doInBackground(Void... params) { int a=5; Log.e("ErrorAsync","before out"); try { Log.e("ErrorAsync","before in"); Transport.send(message); Log.e("ErrorAsync","after in"); } catch (Exception e) { e.printStackTrace(); Log.e("ErrorAsync",e.getMessage()); } Log.e("ErrorAsync","after out"); return true; } @Override protected void onPostExecute(Boolean result) { } @Override protected void onPreExecute() { if(android.os.Debug.isDebuggerConnected()) android.os.Debug.waitForDebugger(); } @Override protected void onProgressUpdate(Void... values) {} }logcat 输出如下09-12 08:29:21.872 6498-6542/? E/ErrorAsync: 退出前09-12 08:29:21.873 6498-6542/? E/ErrorAsync: before in我的问题是:有没有办法在 Marshmallow 或以上操作系统上以编程方式发送电子邮件?
添加回答
举报
0/150
提交
取消