i send mail through my progress with no attachment name, as a result, the 163 mail server rename the attachment to a bin file with no name property in the contenttype.
when i receive the mail and try to Part.getDisposition(), and i got null as the return. but as i see, the mail surely has an attachment and it's mimetype is application/octet-stream.
i was confused whether i coded wrong or not. and my code are as below:
public Vector<Mail> receive(String folderName) throws MessagingException, IOException, InterruptedException {
Vector<Mail> mail_v = new Vector<Mail>();
MailParser mailParser;
Mail mail;
Session session = Session.getDefaultInstance(server.getMailServer(), user);
Store store = session.getStore(this.urlName.getMailURLName());
store.connect();
Folder folder = store.getFolder(folderName);
folder.open(Folder.READ_ONLY);
Message message[] = folder.getMessages();
int message_size = message.length;
// System.out.println(message[310].getContentType());
for(int i = 0; i < message_size; i++) {
if(message.isMimeType("multipart/*")) {
System.out.println(i);
Multipart mu = (Multipart) message[i].getContent();
int mu_size = mu.getCount();
for(int j = 0; j < mu_size; j++) {
BodyPart mu_t = mu.getBodyPart(j);
if(! mu_t.isMimeType("multipart/*")) {
System.out.println("第" + i + "封邮件:" + message[i].getSubject() + " 第" + j + "个BodyPart的内容格式:" + mu_t.getContentType());
String dis = mu_t.getDisposition();
System.out.println(dis);
}
else {
// System.out.println("第" + i + "封邮件:" + message[i].getSubject() + " 第" + j + "个BodyPart的内容格式:" + mu_t.getContentType());
}
}
}
else {
// System.out.println("第" + i + "封邮件:" + message[i].getSubject() + " 的内容格式:" + message[i].getContentType());
}
Thread.sleep(150);
}
folder.close(true);
store.close();
return mail_v;
}
Edited by: EJP on 8/09/2012 15:15: added {noformat}
{noformat} tags. Please use them.