Back to product page

CreateFromHtml Method


Creates new text/html message from saved HTML file.

Syntax

  • Basic
object.CreateFromHtml (From, To, Subject, Filename)
The CreateFromHtml(object,From,To,Subject,Filename) syntax has these parts:
objectAn expression evaluating to an object of type wodSmtp
FromRequired. A String value. Specifies sender of the message.
ToRequired. A String value. Specifies recipient of the message.
SubjectRequired. A String value. Specifies message subject.
FilenameRequired. A String value. Holds filename of saved HTML file template.

Remarks

CreateFromHtml method is a one-line-command that can be used in your applications to create email message from saved HTML file. This method will load required file, parse it, put it in text/html part, and Embed all images and stylesheets found in the message. Basically, this method does the same as Internet Explorer's "Send page by Email" command that can be found on its "File" menu. This method will also take visible text from saved HTML and put it in text/plain part, so that mail readers without html capability can still view the message.

Since wodSmtp is primary a Smtp client, his HTML parsing capabilities are limited. It uses internal HTML parser and doesn't rely on Wininet or Internet Explorer. Due to this, complex HTML files can cause potential errors during parsing, so method is provided "as is". If you encounter HTML file that isn't parsed properly, please send us email about it and explanation on how to duplicate the problem (sample app with saved HTML file would be helpful too).

You can only load HTML content from saved file, wodSmtp will not accept URL of any kind in Filename argument.

To finally send the message, use SendMessage method.

Platforms

Windows