Welcome to DIHtmlMimeMessage!

DIHtmlMimeMessage is a generic component to create MIME messages from existing HTML documents, adding required attachment files automatically. Attachments types include images (inline, background), linked StyleSheets and Scripts. More types can be added easily, just let me know.

During execution, DIHtmlMimeMessage parses the HTML document, locates inline attachment files, creates Content IDs and adjusts the HTML document's links accordingly. An event is triggered for each inline file and should be used to add the appropriate MIME part to the message. After execution, you can send the message using your favourite e-mail / news components.

DIHtmlMimeMessage works with any e-mail / news client. Fully functional example projects including sources are readily available for Indy, SakEMail, Synapse, and tpIPro.

Features

  • Scans HTML documents for message attachments.
  • Full Unicode, with 70+ character encodings.
  • Automatically convert HTML to ISO-8859-1 / Latin 1 character set.
  • Normalize HTML white-space option.
  • Resolve relative paths to locate attachment files.
  • Check if files exist before attaching them.
  • Modify attachment HTML links as required.
  • Detect multiple references to the same file.
  • Resolve names of files with the same name in different folders.

Usage

To create a MIME message from an existing HTML file requires two basic events only:

TDIHtmlMimeMessage.OnAttachment
This event is fired once for each file to attach. It passes attachment details to applications so they can add them to the e-mail message.
TDIHtmlMimeMessage.OnEnd
This event is called after the HTML document is fully parsed. It passes a pointer to the buffer of the modified HTML document, as well as the buffer size in bytes.

Supported Attachment Types

Inline Images
Document Background Image

This image is also set as the document's background image.

Table Cell Background Images  
Table Row Backgound Images The next row contains a background image. Row background images are not covered by the HTML specifications, and are not supported all browser.
If this row is empty, your HTML viewer does not support table row background images.
StyleSheets There is no style sheet example in this document.
Scripts There is no script example in this document.
Others Are you missing an attachment type in DIHtmlMimeMessage? Mail your requests to delphi@yunqa.de and I will be glad to add it to the next release.

Contact

For questions and suggestions please e-mail to delphi@yunqa.de.

Copyright & License

DIHtmlMimeMessage is copyright (c) 2004-2010 Ralf Junker, The Delphi Inspiration.

  1. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  2. The origin of this software must not be misrepresented, either by explicit claim or by omission.
  3. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
  4. Dependency on DIHtmlParser must not be removed from this software.