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.
[Syntax] Visual C++: HRESULT ImportHtml(BSTR Html, BSTR BasePath, long* pVal) Visual Basic: ImportHtml(Html As String, BasePath As String) As Long
Parameters
Return Value
Remarks
Example
[Visual Basic, Delphi, Visual 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.
[VB6, VBA - Import Html Body and Embedded Image] Private Sub btnSendMail_Click() Dim oSmtp As New EASendMailObjLib.Mail oSmtp.LicenseCode = "TryIt" ' test.gif is in c:\my picture ' test.gif will be imported as embedded image in the email oSmtp.ImportHtml "<html><body>test <img src=""test.gif""> importhtml</body></html>", _ "c:\my picture" ' You save it to EML file or call SendMail method to send this email out oSmtp.SaveMail "c:\test.eml" End Sub
[Delphi - Import Html Body and Embedded Image] Procedure TForm1.Button1Click(Sender: TObject); var: oSmtp: TMail; begin oSmtp := TMail.Create(Application); oSmtp.LicenseCode = 'TryIt' // test.gif is in c:\my picture // test.gif will be imported as embedded image in the email oSmtp.ImportHtml('<html><body>test <img src="test.gif"> importhtml</body></html>', 'c:\my picture'); // You save it to EML file or call SendMail method to send this email out oSmtp.SaveMail('c:\test.eml'); end;
[Visual C++ - Import Html Body and Embedded Image] #include "stdafx.h" #include "easendmailobj.tlh" using namespace EASendMailObjLib; int _tmain(int argc, _TCHAR* argv[]) { ::CoInitialize(NULL); IMailPtr oSmtp = NULL; oSmtp.CreateInstance(__uuidof(EASendMailObjLib::Mail)); oSmtp->LicenseCode = _T("TryIt"); // test.gif is in c:\my picture // test.gif will be imported as embedded image in the email oSmtp->ImportHtml(_T("<html><body>test <img src=\"test.gif\"> importhtml</body></html>"), _T("c:\my picture")); // You save it to EML file or call SendMail method to send this email out oSmtp.SaveMail(_T("c:\\test.eml")); return 0; }
Online Examples
Visual C++ - Send HTML Email with Embedded Images
Visual Basic - Send HTML Email with Embedded Images
Delphi - Send HTML Email with Embedded Images
See Also