代碼發送電子郵件以下內容: MimeMessage msg = new MimeMessage(session);
msg.setSubject("subject", "UTF-8"); // here you specify your subject encoding
msg.setContent("yourBody", "text/plain; charset=utf-8"
我已將單個郵件存儲爲我的磁盤上的.eml文件。當需要將它們從磁盤讀取到內存中時,我無法恢復電子郵件的正文(文本)。下面的代碼讀取.eml文件 String filePath = "filepath\\msg0.eml";
InputStream is = new FileInputStream(filePath);
MimeMessage mime = new MimeMessage(null