Chilkat MHT: GetEmail, GetMime, HtmlToEmail Methods Removed

Chilkat MHT methods that returned either an email object or a MIME object were removed in the v9.5.0 release. The reason for this was to decouple the internal dependencies between these objects. In some environments, such as for iOS, the size of the resultant executable can be important, and the internal linking between these objects increases the size. The decision for removing these methods was chosen because:

  1. To eliminate internal dependencies and thus potentially reduce executable size.
  2. Because the same functionality is achieved with one extra line of application code (see below).  This is no less efficient than if Chilkat returned the objects directly.
            Chilkat.Mht mht = new Chilkat.Mht();
            Chilkat.Email email = new Chilkat.Email();
            Chilkat.Mime mimeObj = new Chilkat.Mime();

            // ...

            string mime = mht.GetMHT("http://www.chilkatsoft.com/");
            if (mime == null)
            {
                // error..
            }

            // To load MIME into an email object:
            email.SetFromMimeText(mime);

            // To load MIME into a MIME object:
            mimeObj.LoadMime(mime);

MHT and EML are both MIME

Question:

I have added HTML email file support (thanks to your excellent examples and library), but I have a question. It appears that it might be easier for the end user to save their things they want to email as a MHT file instead of HTML out of MS-Word. That way they have one file to deal with. So is there a way to do the same method for email using and MHT file?

Answer:

MHT and EML are the exact same thing — they are both MIME.  The only difference is the file extension and the intended use of the file (as indicated by the file extension).  MHT is intended to be displayed in Internet Explorer, and EML is intended to be an email.  A .eml file will contain header files (Subject, To, From, etc.) that are not present in MHT. Therefore, to “convert” an MHT to EML, simply load it into an email object by calling LoadEml, set the Subject and From properties.  Then Add recipients by calling AddTo, AddCC, etc., and then send…

Improving MHT Download Performance with Caching

Question:
I’m spidering search results and trying to archive hundreds of pages to MHT’s.  I’m testing your control and found it much slower than Internet Explorer. Also, while I’m not doing this now, is this control threadsafe if I ever wanted to try that to improve performance?

Answer:

Internet Explorer is faster because it uses multiple threads, and because it uses disk caching.  Both can be accomplished using Chilkat MHT.

First, the easy answer:  Yes, the MHT component/library is thread-safe.  Of course, each thread should use it’s own instance of an MHT object.  Also, the disk-caching is thread-safe.  Multiple threads can be updating files in the same caching directory without interfering with each other.

Implementing disk caching with MHT is easy.  It’s simply a matter of setting a few properties and telling the component the path of the cache directory.  Here are examples:

ASP: Download Web Page to MHT with w/ Disk Cache

SQL Server: Download Web Page to MHT with w/ Disk Cache

C#: Download Web Page to MHT with w/ Disk Cache

C++: Download Web Page to MHT with w/ Disk Cache

MFC: Download Web Page to MHT with w/ Disk Cache

C: Download Web Page to MHT with w/ Disk Cache

Delphi: Download Web Page to MHT with w/ Disk Cache

Visual FoxPro: Download Web Page to MHT with w/ Disk Cache

Java: Download Web Page to MHT with w/ Disk Cache

Perl: Download Web Page to MHT with w/ Disk Cache

PHP: Download Web Page to MHT with w/ Disk Cache

Python: Download Web Page to MHT with w/ Disk Cache

Ruby: Download Web Page to MHT with w/ Disk Cache

VB.NET: Download Web Page to MHT with w/ Disk Cache

Visual Basic: Download Web Page to MHT with w/ Disk Cache

VBScript: Download Web Page to MHT with w/ Disk Cache