Click here to Skip to main content
15,887,464 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to open and display .eml file (microsoft outlook) from a folder i have .eml file in a particular folder in asp .net c# in a new tab


What I have tried:

on Link button Click code

var path = Server.MapPath(Path);

        var cd = new System.Net.Mime.ContentDisposition();
        cd.FileName = path;
        cd.Inline = false;

        Response.AddHeader("Content-Disposition", cd.ToString());
        Response.TransmitFile(path);
        Response.ContentType = "application/vnd.ms-outlook";
        Response.Flush();
        Response.End();
Posted
Updated 10-Jun-20 6:30am
v3

1 solution

If you want the file to be displayed in the browser, the user will need to have an application capable of displaying it in the browser, and you will need to set Inline to true.

If you set Inline = false, that forces the browser to download the file, even if it is capable of displaying it within the browser.

To display a MIME message in the browser regardless of the user's software, you'll need to parse it yourself and render the relevant parts in an HTML view. The best tool to parse the message in C# is probably MimeKit[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900