SmtpMail.ImportHtmlBody Method


Imports HTML source from file or remote website 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 ImportHtmlBody( _
    fileName As String, _
    options As ImportHtmlBodyOptions _
)
[C#]
public void ImportHtmlBody(
    string fileName,
    ImportHtmlBodyOptions options
);
[C++]
public: void ImportHtmlBody(
    String* fileName,
    ImportHtmlBodyOptions^ options
);
[JScript]
public function ImportHtmlBody( 
    fileName : String,
    options : ImportHtmlBodyOptions* options
);

Parameters

fileName
A full file name or URL.
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")
oMail.ImportHtmlBody( "http://google.com", _ 
	ImportHtmlBodyOptions.ImportHttpPictures OR ImportHtmlBodyOptions.ImportCss )

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

oMail.ImportHtmlBody( "c:\test.htm", _
	ImportHtmlBodyOptions.ImportLocalPictures OR ImportHtmlBodyOptions.ImportCss )

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

[C# - Import Html Body and Embedded Image]
SmtpMail oMail = new SmtpMail("TryIt");
oMail.ImportHtmlBody( "http://google.com", 
	ImportHtmlBodyOptions.ImportHttpPictures | ImportHtmlBodyOptions.ImportCss );

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

oMail.ImportHtmlBody( "c:\\test.htm", 
	ImportHtmlBodyOptions.ImportLocalPictures | ImportHtmlBodyOptions.ImportCss );

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

See Also

ImportHtmlBodyOptions Enumeration
Attachment Class
SmtpMail.ImportHtml 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