• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading an outlook .msg file stored in server to my servlet

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone, i have been facing one problem while reading an outlook .msg file to my servlet and then opening that file as pop up using servletoutputstream so that user can download that file.The problem is i could get that file using msgparser but after outputting that file i was unable to store it as original outlook file.size of output file is getting reduced , i dont know whether source file in server is encoded or not. can anyone help me out in getting exact server file in the client machine so that client can open it in is outlook..
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most likely there's something wrong with your code. But we can't see it so all we can say is that it's probably wrong. I would suggest you post it.
 
kalyan raj
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly thanks for your reply.. Well below is the code iam using ..

MsgParser msgp = new MsgParser();

Message msg = msgp.parseMsg("c://Testingmail.msg");//some msg file which i have taken from outlook and kept in local disk

String str1=msg.toString();

b=str1.getBytes();// here b is byte array

//The below code is to open show the pop up so that user can save the msg file..

response.setContentType("application/vnd.ms-outlook"+" ;charset=utf-8");

response.setHeader("Content-Disposition",
"attachment;filename=" + "Testingmail.msg");

ServletOutputStream servletOutputStream = response
.getOutputStream();


DataOutput dataOutput = new DataOutputStream(
servletOutputStream);

if (b!= null) {
response.setContentLength(b.length);

for (int i = 0; i < b.length; i++) {
dataOutput.writeByte(b[i]);
}



}
if (servletOutputStream != null) {

servletOutputStream.flush();

servletOutputStream.close();
}



I tried with many combinations while reading the msg file from server path like using bufferreader ... once i save the file , iam getting in msg format but not actual content .. when i say open directly , it is saying error cannot open file or you dont have permission ...... if i drag that downloaded file it is going as attachment of new mail..one thing is for sure.. iam not getting actual content of server file..i think once we say save from outlook it will be stored as encoded file.. we need to decode it..i tried by decoding the file also but invain if you have code to get it please share ...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic