当前位置: 代码迷 >> Android >> Android 之APP程序崩溃后,从动向QQ 邮箱发送邮件
  详细解决方案

Android 之APP程序崩溃后,从动向QQ 邮箱发送邮件

热度:65   发布时间:2016-04-28 04:53:04.0
Android 之APP程序崩溃后,自动向QQ 邮箱发送邮件

    private void sendAppCrashReport(final Context context, final String crashReport, final String file) {     	    	  try           {            MailSenderInfo mailInfo = new MailSenderInfo();               mailInfo.setMailServerHost("smtp.qq.com");               mailInfo.setMailServerPort("25");               mailInfo.setValidate(true);               mailInfo.setUserName("[email protected]");  //你的邮箱地址             mailInfo.setPassword("xxxx");//您的邮箱密码               mailInfo.setFromAddress("[email protected]");               mailInfo.setToAddress("[email protected]");               mailInfo.setSubject("程序异常");               mailInfo.setContent(crashReport);                             //这个类主要来发送邮件              SimpleMailSender sms = new SimpleMailSender();              String file1=Environment.getExternalStorageDirectory().getAbsolutePath()+ "/dbqst/qst.db";             sms.sendTextMail(mailInfo,file1);//发送文体格式                 //sms.sendHtmlMail(mailInfo);//发送html格式           }           catch (Exception e) {               Log.e("SendMail", e.getMessage(), e);           }    	     }  

  相关解决方案