Email
| 📊 Overview: 2 Properties | 1 Constructor | 12 Functions |
📝 Description
Creates a new email with the specified subject and HTML body
🕐 Last updated: 2025-12-10T11:45:22.710Z
📑 Table of Contents
- 📋 Properties (2)
- 🏗️ Constructor (2 params)
- ⚙️ Functions
- Regular Functions
- addTo (1 param)
- addCc (1 param)
- addBcc (1 param)
- addPermissionGroup (3 params)
- addCustomerGroup (1 param)
- setFromAddress (2 params)
- setFromCurrentUser →
$Success : Boolean - setMessageID (1 param)
- setHtmlBody (1 param)
- setSubject (1 param)
- attachFile (2 params)
- send →
$EmailSent : Boolean
- Regular Functions
Properties
| Property | Type | Default | Description |
|---|---|---|---|
EmailObject | Object | {} | The main email object containing all email properties (to, from, subject, body, attachments, etc.) |
_PermissionFooterCollection | Collection | [] | Internal collection tracking permission groups for footer display |
Constructor
constructor
[🏗️ constructor]
Class constructor($Subject : Text; $HTML_Body : Text)
Creates a new email with the specified subject and HTML body
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$Subject | Text | - | - |
$HTML_Body | Text | - | - |
Functions
Regular Functions
addTo
Function addTo($EmailAddress : Text)
Adds an email address to the To recipients list (only if not already present)
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$EmailAddress | Text | - | - |
addCc
Function addCc($EmailAddress : Text)
Adds an email address to the CC (carbon copy) recipients list (only if not already present)
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$EmailAddress | Text | - | - |
addBcc
Function addBcc($EmailAddress : Text)
Adds an email address to the BCC (blind carbon copy) recipients list (only if not already present)
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$EmailAddress | Text | - | - |
addPermissionGroup
Function addPermissionGroup($PermissionName : Text; $RecipientType : Integer; $ShowPermissionFooter : Boolean)
Adds all staff members with the specified permission to recipients, optionally showing permission name in footer
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$PermissionName | Text | - | - |
$RecipientType | Integer | - | - |
$ShowPermissionFooter | Boolean | - | - |
addCustomerGroup
Function addCustomerGroup($CustomerCode : Text)
Adds all contacts for the specified customer code to the To recipients list
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$CustomerCode | Text | - | - |
setFromAddress
Function setFromAddress($EmailAddress : Text; $EmailName : Text)
Sets the sender’s email address and optional display name (appends @TLD if no @ present)
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$EmailAddress | Text | - | - |
$EmailName | Text | - | - |
setFromCurrentUser
Function setFromCurrentUser -> $Success : Boolean
Sets the sender to the currently logged-in user’s email and name from Storage.User.ID
Returns: Boolean
setMessageID
Function setMessageID($MessageID : Text)
Sets the email’s message ID and reply-to ID (appends @TLD to the provided ID)
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$MessageID | Text | - | - |
setHtmlBody
Function setHtmlBody($HTML_Body : Text)
Sets the HTML body content of the email
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$HTML_Body | Text | - | - |
setSubject
Function setSubject($Subject : Text)
Sets the subject line of the email
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$Subject | Text | - | - |
attachFile
Function attachFile($FilePathBlobOrObject : Variant; $BlobFileName : Text)
Attaches a file to the email - accepts file path (Text), BLOB, 4D.Blob, or 4D.File object
🗨️ Note: Additional warning about file size limits, file path format, etc.
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$FilePathBlobOrObject | Variant | - | - |
$BlobFileName | Text | - | - |
send
Function send -> $EmailSent : Boolean
Sends the email using SMTP settings from database, adds permission footer if applicable, returns success status
Returns: Boolean
Generated from Email.4dm