On Windows, you can do this directly using the CDO.Message COM component, which provides the IMessage interface
I don't know the details of importing COM objects in C #, so I will give you a quick example in the C-like syntax:
IMsgObj = CreateObject("CDO.Message") // create the object IMsgObj.CreateMHTMLBody("http://www.example.com/") // convert the URL to MHTML IMsgObj.GetStream().SaveToFile("output.mht") // save it to a file
CLSID of components CDO.Message {CD000001-8B95-11D1-82DB-00C04FB1625D}
Keep in mind that this component is designed to generate e-mail messages (the file extension is .eml, not .mht), which means that JavaScript files are not included. Otherwise, they are roughly equivalent.
Getfree
source share