1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
MsgParser msgp = new MsgParser();
Message msg = msgp.parseMsg(img_data.getBinaryStream());
OutputStream output = response.getOutputStream();
String from = "DE : " + msg.getFromEmail();
String to = "A : " + msg.getDisplayTo();
String cc = "Cc : " + msg.getDisplayCc();
String objet = "Objet : " + msg.getSubject();
//response.setContentType("application/octet-stream");
List<Attachment> atts = msg.getAttachments();
for (int i = 0; i < atts.size(); i++) {
FileAttachment file = (FileAttachment) atts.get(i);
System.out.println("file : "[ATTACH=CONFIG]166035[/ATTACH]
+ file.getLongFilename()
+ " type is : "
+ new MimetypesFileTypeMap().getContentType(file
.getLongFilename()));
//response.addHeader("Content-Disposition", "inline; filename=" + file.getLongFilename());
byte[] date = file.getData();
// BufferedImage bImageFromConvert = ImageIO
// .read(new ByteArrayInputStream(date));
// ImageIO.write(bImageFromConvert, file.getExtension(), output);
System.out.println("date " + i + " : is :" + date.length);
// output.write(date);
}
System.out.println("converted html is : "
+ msg.getConvertedBodyHTML());
output.write(from.getBytes());
output.write("<BR>".getBytes());
output.write(to.getBytes());
output.write("<BR>".getBytes());
output.write(cc.getBytes());
output.write("<BR>".getBytes());
output.write(objet.getBytes());
output.write("<BR>".getBytes());
output.write("<BR>".getBytes());
output.write(msg.getConvertedBodyHTML().getBytes());
output.flush();
output.close(); |
Partager