Bonjour tous le monde,
J’ai stocké un mail outlook .msg dans ma base de donnée en type Blob.
J’utilise le struts 1.3 et spring 2 comme technologie.
Je veux lorsque je clique sur le bouton ‘affiche mail’, le mail sera affiché dans mon browser (IE).
J’ai utilisé l’api msgparser il affiche très bien le message mais les images ne s’affiche pasexemple en pièce jointe :
Voici le code utilisé :
Merci pour votre réponse.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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();
Cordialement,
Seoud Ala Eddine
Partager