Imports specified html file or URL with embedded pictures/images to current email.
[Syntax] Visual C++: HRESULT ImportMailEx(BSTR FileName, long* pVal) Visual Basic: ImportMailEx(FileName 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.htm contains the following content: '<html><body>this is an inline <img src="c:\my pictures\test.gif"> image</body></html> ' test.gif will be imported as embedded image in the email oSmtp.ImportMailEx "c:\my folder\test.htm" ' 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.htm contains the following content: // <html><body>this is an inline <img src="c:\my pictures\test.gif"> image</body></html> // test.gif will be imported as embedded image in the email oSmtp.ImportMailEx('c:\my folder\test.htm'); // 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.htm contains the following content: // <html><body>this is an inline <img src="c:\my pictures\test.gif"> image</body></html> // test.gif will be imported as embedded image in the email oSmtp->ImportMailEx(_T("c:\\my folder\\test.htm")); // 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