目前我正在编写一个将要监听目录的代码.当使用.apk文件更新目录时,我会将带有此.apk文件的邮件发送到gmail帐户.我在我的程序中使用Jnotify和JAVA Mail.
我得到的错误是,
javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_0_145238.1392728439484"
Run Code Online (Sandbox Code Playgroud)
我在stackoverflow中寻找了解决方案以寻求帮助,但没有一个在哪里有用.
提前致谢
public void fileCreated(int wd, String rootPath, String name) {
print("created " + rootPath + " : " + name);
if (name.contains(".apk"))
SendEmail(name);
else
System.out.println("Not the APK file");
}
void SendEmail(String strname){
String Path = "D:/POC/Email/apk folder/"+strname;
System.out.println("Path->" + Path);
Properties props = new Properties();
props.put("mail.smtp.host","173.194.78.108");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth","true");
props.put("mail.smtp.port","465");
System.out.println("Properties has been set properly");
Session session = …Run Code Online (Sandbox Code Playgroud)