SmtpMail.ImportHtml Method


Imports HTML source from string to HTML body of the e-mail message. This method also import linked images/pictures in the HTML source to embedded images.

[Visual Basic]
Public Sub ImportHtml( _
    source As String, _
    basePath As String, _
    options As ImportHtmlBodyOptions _
)
[C#]
public void ImportHtml(
    string source,
    string basePath,
    ImportHtmlBodyOptions options
);
[C++]
public: void ImportHtml(
    String* source,
    String* basePath,
    ImportHtmlBodyOptions^ options
);
[JScript]
public function ImportHtml( 
    source : String,
    basePath : String,
    options : ImportHtmlBodyOptions* options
);

Parameters

source
A html text string.
source
Root path for embedded pictures that uses relative path in html source.
options
Any combination of ImportHtmlBodyOptions values

Example

[Visual Basic, C#] The following example demonstrates how to import remote & local html source with EASendMail SMTP Component. To get the full samples of EASendMail, please refer to Samples section.

[VB - Import Html Body and Embedded Image]
Dim oMail As SmtpMail = New SmtpMail("TryIt")

'test.gif is in c:\my picture
oMail.ImportHtmlBody( "<html><body>test <img src=""test.gif""> importhtml</body></html>", _
	"c:\my picture", _
	ImportHtmlBodyOptions.ImportLocalPictures OR ImportHtmlBodyOptions.ImportCss )

oMail.SaveAs( "c:\test.eml", true )

[C# - Import Html Body and Embedded Image]
oMail.ImportHtml( "<html><body>test <img src=\"test.gif\"> importhtml</body></html>",
	"c:\\my picture", //test.gif is in c:\\my picture
	ImportHtmlBodyOptions.ImportLocalPictures | ImportHtmlBodyOptions.ImportCss );

oMail.SaveAs( "c:\\test.eml", true );

See Also

ImportHtmlBodyOptions Enumeration
Attachment Class
SmtpMail.ImportHtmlBody Method
SmtpMail.HtmlBody Property

Online Examples

C# - Send Email with Attachment
C# - Send Email with Embedded Images
VB - Send Email with Attachment
VB - Send Email with Embedded Images
C++/CLI - Send Email with Attachment
C++/CLI - Send Email with Embedded Images