+ };
+ mailTask.execute();
+
+ }
+
+ private static final String SMTP_SERVER = "smtp.exmail.qq.com";
+ private static final String USER = "support@suanzi.ai";
+ private static final String SENT_MAIL = "support@suanzi.ai";
+ private static final String PASSWORD = "oqiDX8fcWa58CmNf";
+ private static final String RECV_MAIL = "support@suanzi.ai";
+
+ private static boolean sendMail(String attachment){
+
+ String account = UserInfo.user;
+ String subject = UserInfo.macAddr + " - " + BuildConfig.VERSION_NAME + " - " + BuildConfig.GIT_REVISION;
+ StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
+ StrictMode.setThreadPolicy(policy);
+
+ Properties props = new Properties();
+ props.setProperty("mail.transport.protocol", "smtp");
+ props.setProperty("mail.smtp.host", SMTP_SERVER);
+ props.setProperty("mail.smtp.auth", "true");
+ /*final String smtpPort = "465";
+ props.setProperty("mail.smtp.port", smtpPort);
+ props.setProperty("mail.smtp.socketFactory.class", "javax.NET.ssl.SSLSocketFactory");
+ props.setProperty("mail.smtp.socketFactory.fallback", "false");
+ props.setProperty("mail.smtp.socketFactory.port", smtpPort);*/
+ Session session = Session.getDefaultInstance(props);
+ session.setDebug(true);
+
+ MimeMessage message = new MimeMessage(session);
+ try {
+ message.setFrom(new InternetAddress(SENT_MAIL, account, "UTF-8"));
+ message.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(RECV_MAIL, "support", "UTF-8"));
+ message.setSubject(subject, "UTF-8");
+ //message.setContent("hahaha", "text/html;charset=UTF-8");
+ message.setSentDate(new Date());
+
+
+ BodyPart messageBodyPart = new MimeBodyPart();
+ messageBodyPart.setText("This is message body");
+ Multipart multipart = new MimeMultipart();
+ multipart.addBodyPart(messageBodyPart);
+ messageBodyPart = new MimeBodyPart();
+ DataSource source = new FileDataSource(attachment);
+ messageBodyPart.setDataHandler(new DataHandler(source));
+
+ String fname = attachment.substring(attachment.lastIndexOf("/") + 1);
+ messageBodyPart.setFileName(fname);
+ multipart.addBodyPart(messageBodyPart);
+
+ // Send the complete message parts
+ message.setContent(multipart);
+ message.saveChanges();
+
+ Transport transport = session.getTransport();
+ transport.connect(USER, PASSWORD);
+ transport.sendMessage(message, message.getAllRecipients());
+ transport.close();
+ } catch (Exception e){
+ gLogger.error("send mail, error: " + e.getMessage());