Imports, into the Email structure or into an Email variable, the content of an HTML file in order to send it by email. The images found in the HTML file are automatically included in the Email structure or in the Email variable.
- In the Email structure: The email structure handled by the current thread is filled: the Email.HTML variable as well as the Email.Attach[...] and Email.NbAttach variables are initialized according to the HTML content.
- In the Email variable: The current Email variable is filled: the NbAttach, Attach[...] and HTML properties are initialized according to the HTML content.
Remark: The images integrated by encoding in the HTML file are processed.
Remark: The HTML content is supported in POP3/SMTP only: this function must be used only if the email is sent in SMTP.
MyHTMLText is ANSI string
MyHTMLText = fLoadText("C:\Email\MyEmail.htm")
Email.Recipient = "firstname.lastname@example.org"
Email.Subject = "Test"
EmailImportHTML([<Email>, ] <HTML content to send> , <Directory> [, <Options>])
<Email>: Optional Email variable
Name of the Email variable corresponding to the email into which the HTML document will be imported.
If this parameter is not specified, Email.HTML
(variable of Email structure) is filled with <HTML content to send>.
<HTML content to send>: ANSI character string
Email content in HTML format.
<Directory>: Character string
Reference directory for the images (case of relative paths in the HTML content).
<Options>: Optional Integer constant
Import options (when using the Email structure only):
|A unique identifier is generated to identify each image found in the HTML file. This identifier is unique regardless of the imported HTML file.|
Default operating mode.
|emailOptionNoCID||An identifier is generated for the images in the HTML file. This identifier is not unique. If several HTML files are imported, they can use the same image identifier.|
Operating mode of images and attachments
If <HTML content to send> refers to images:
- these images are automatically added as attachments to the email (in the Email or in the Email variable).
- the HTML code of message is modified in order to reference the attachments.
Caution: The attachments are "added" to the email. For example, if the Email.NbAttach variable is set to 2 before the call to EmailImportHTML and if the HTML content references an image, this image will be included in the Email.Attach variable and the Email.NbAttach variable will be set to 3.
The additional attachments must be added before using EmailImportHTML.
The order in which the attachments are sent is not necessarily respected when the email is received.
The identifier of images is a unique identifier.Remark: If the import is performed in an Email variable, the images integrated by encoding in the source HTML file are processed.
Unit examples (WINDEV): Sending an email in HTML format
Complete examples (WINDEV): WD Mail