Unable to open attachments in a mail which are stored as Image in

P

Pochi

Hi,

I am facing one typical problem. I want to create one aspx screen which
lists all the outlook mail's as an hyperlink in a DataGrid.

Scenario: Outlook Mail Contains both Mail and attachments. The mail is
stored as Image in Database and Attachments also stored as Image but in a
separate table.

Problem: While Retrieving, When I Click on Mail Hyperlink in Grid, I am
using MemoryStream and FileStream to dump the Image data of both Mail and
attachments into Temporary MSG File in a local folder. When I tried to Open
the MSG file, the outlook is opening with Reply, ReplyAll and Forward Options
with Attachments in Attachments section. When I tried to open that
attachment, it is giving "Not Found" error Message.

I tried with merging both Mail and Attachment Binary data into a single
mail, but not succeded.

Is there any approach to merge these two, so that MSG file can open the
attachment also.

I am using C#.Net.

Code:
MemoryStream ms = new MemoryStream(attachmentContent[0].AttachmentContent);
//attachmentContent[0].AttachmentContent is in byte[] (this Contains both
attachments and Mail Binary Data)

FileStream fs = new FileStream("C:\\DEV\\Apps\\Web\\demo\\Output\\" +
fileName + "." + attachmentContent[0].AttachmentExt, FileMode.Create);
ms.WriteTo(fs);
Page.RegisterStartupScript("Open",
"<script>window.open('http://localhost/demo/Output/" + fileName + "." +
attachmentContent[0].AttachmentExt + "');</script>");

Any help will be highly appreciated.

Thanks In Advance,
Sripathi Rao
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top