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 _
public void ImportHtml(
    string source,
    string basePath,
    ImportHtmlBodyOptions options
public: void ImportHtml(
    String* source,
    String* basePath,
    ImportHtmlBodyOptions^ options
public function ImportHtml( 
    source : String,
    basePath : String,
    options : ImportHtmlBodyOptions* options


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


[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