Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

generate .mht file programmatically

Tags:

c#

mhtml

Does anybody know how to generate .mht file programmatically in C#, with embedded images in it? The thing is i have realised that .mht files are capable of embedding images in them, and this embedded images moves with the whole file(mht) when you change its location. And this file can be viewed on different browsers, including IE 6.

I was told to try Data Url Scheme technique. But it couldn't work because its not supported by other browsers. e.g IE 6.

like image 468
chosenOne Thabs Avatar asked Apr 03 '12 19:04

chosenOne Thabs


People also ask

What's a .MHT file?

An MHT file is a webpage archive saved by a web browser, such as Google Chrome or Microsoft Edge. It is saved in the MIME HTML or "MHTML" format, which stores HTML, CSS, JavaScript, images, and other linked resources into a single file.


1 Answers

MSDN has a great article (June 2011) about how to create an MHT file using both CDO and System.Net.Mail. C# source code is included in-full. I would use this above the VB.Net or Google Code version.

like image 149
Jason S Avatar answered Oct 13 '22 00:10

Jason S