Codeunit Email
Provides functionality to create and send emails.
Properties
| Name | Value |
|---|---|
| Access | Public |
Methods
SaveAsDraft
Saves a draft email in the Outbox.
procedure SaveAsDraft(EmailMessage: Codeunit "Email Message")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to save. |
SaveAsDraft
Saves a draft email in the Outbox.
procedure SaveAsDraft(EmailMessage: Codeunit "Email Message", var EmailOutbox: Record "Email Outbox")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to save. |
| EmailOutbox | Table System.Email."Email Outbox" |
The created outbox entry. |
SaveAsDraft
Saves a draft email in the Outbox.
procedure SaveAsDraft(EmailMessage: Codeunit "Email Message", EmailAccountId: Guid, EmailConnector: Enum "Email Connector", var EmailOutbox: Record "Email Outbox")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to save. |
| EmailAccountId | Guid |
The email account ID for sending. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector for sending. |
| EmailOutbox | Table System.Email."Email Outbox" |
The created outbox entry. |
Enqueue
Enqueues an email to be sent in the background.
procedure Enqueue(EmailMessage: Codeunit "Email Message")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
Remarks
The default account will be used for sending the email.
Enqueue
Enqueues an email to be sent in the background.
procedure Enqueue(EmailMessage: Codeunit "Email Message", NotBefore: DateTime)
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| NotBefore | DateTime |
The date and time for sending the email. |
Remarks
The default account will be used for sending the email.
Enqueue
Enqueues an email to be sent in the background.
procedure Enqueue(EmailMessage: Codeunit "Email Message", EmailScenario: Enum "Email Scenario")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailScenario | Enum System.Email."Email Scenario" |
The scenario to use in order to determine the email account to use for sending the email. |
Enqueue
Enqueues an email to be sent in the background.
procedure Enqueue(EmailMessage: Codeunit "Email Message", EmailScenario: Enum "Email Scenario", NotBefore: DateTime)
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailScenario | Enum System.Email."Email Scenario" |
The scenario to use in order to determine the email account to use for sending the email. |
| NotBefore | DateTime |
The date and time for sending the email. |
Enqueue
Enqueues an email to be sent in the background.
procedure Enqueue(EmailMessage: Codeunit "Email Message", EmailAccount: Record "Email Account" temporary)
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccount | Table System.Email."Email Account" |
The email account to use for sending the email. |
Remarks
Both "Account Id" and Connector fields need to be set on the EmailAccount parameter.
Enqueue
Enqueues an email to be sent in the background.
procedure Enqueue(EmailMessage: Codeunit "Email Message", EmailAccount: Record "Email Account" temporary, NotBefore: DateTime)
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccount | Table System.Email."Email Account" |
The email account to use for sending the email. |
| NotBefore | DateTime |
The earliest date and time for sending the email. |
Enqueue
Enqueues an email to be sent in the background.
procedure Enqueue(EmailMessage: Codeunit "Email Message", EmailAccountId: Guid, EmailConnector: Enum "Email Connector")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
Enqueue
Enqueues an email to be sent in the background.
procedure Enqueue(EmailMessage: Codeunit "Email Message", EmailAccountId: Guid, EmailConnector: Enum "Email Connector", NotBefore: DateTime)
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
| NotBefore | DateTime |
The date and time for sending the email. |
Send
Sends the email in the current session.
procedure Send(EmailMessage: Codeunit "Email Message"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the email was successfully sent; otherwise - false. |
Remarks
The default account will be used for sending the email.
Send
Sends the email in the current session.
procedure Send(EmailMessage: Codeunit "Email Message", EmailScenario: Enum "Email Scenario"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailScenario | Enum System.Email."Email Scenario" |
The scenario to use in order to determine the email account to use for sending the email. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the email was successfully sent; otherwise - false. |
Send
Sends the email in the current session.
procedure Send(EmailMessage: Codeunit "Email Message", EmailAccount: Record "Email Account" temporary): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccount | Table System.Email."Email Account" |
The email account to use for sending the email. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the email was successfully sent; otherwise - false |
Remarks
Both "Account Id" and Connector fields need to be set on the EmailAccount parameter.
Send
Sends the email in the current session.
procedure Send(EmailMessage: Codeunit "Email Message", EmailAccountId: Guid, EmailConnector: Enum "Email Connector"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the email was successfully sent; otherwise - false |
Reply
Obsolete
This element will become obsolete from version 26.0. Replaced by Reply without the ExternalId parameter. ExternalId is not used and is contained in the EmailMessage parameter.
Sends a reply to an external message id in the foreground.
[Obsolete(Replaced by Reply without the ExternalId parameter. ExternalId is not used and is contained in the EmailMessage parameter.,26.0)]
procedure Reply(EmailMessage: Codeunit "Email Message", ExternalId: Text, EmailAccountId: Guid, EmailConnector: Enum "Email Connector"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message with the details of the recipients and reply to be added. |
| ExternalId | Text |
The external message id that is used to correlate and send the reply. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if sent |
ReplyAll
Obsolete
This element will become obsolete from version 26.0. Replaced by ReplyAll without the ExternalId parameter. ExternalId is not used and is contained in the EmailMessage parameter.
Sends a reply to an external message id to all recipients on that email in the foreground.
[Obsolete(Replaced by ReplyAll without the ExternalId parameter. ExternalId is not used and is contained in the EmailMessage parameter.,26.0)]
procedure ReplyAll(EmailMessage: Codeunit "Email Message", ExternalId: Text, EmailAccountId: Guid, EmailConnector: Enum "Email Connector"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message with the details of the recipients and reply to be added. |
| ExternalId | Text |
The external message id that is used to correlate and send the reply. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if sent |
EnqueueReply
Obsolete
This element will become obsolete from version 26.0. Replaced by EnqueueReply without the ExternalId parameter. ExternalId is not used and is contained in the EmailMessage parameter.
Sends a reply to an external message id in the background.
[Obsolete(Replaced by EnqueueReply without the ExternalId parameter. ExternalId is not used and is contained in the EmailMessage parameter.,26.0)]
procedure EnqueueReply(EmailMessage: Codeunit "Email Message", ExternalId: Text, EmailAccountId: Guid, EmailConnector: Enum "Email Connector", var EmailOutbox: Record "Email Outbox")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message with the details of the recipients and reply to be added. |
| ExternalId | Text |
The external message id that is used to correlate and send the reply. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
| EmailOutbox | Table System.Email."Email Outbox" |
The email outbox which is set up for sending in the background. |
EnqueueReplyAll
Obsolete
This element will become obsolete from version 26.0. Replaced by EnqueueReplyAll without the ExternalId parameter. ExternalId is not used and is contained in the EmailMessage parameter.
Sends a reply to an external message id to all recipients on that email in the foreground.
[Obsolete(Replaced by EnqueueReplyAll without the ExternalId parameter. ExternalId is not used and is contained in the EmailMessage parameter.,26.0)]
procedure EnqueueReplyAll(EmailMessage: Codeunit "Email Message", ExternalId: Text, EmailAccountId: Guid, EmailConnector: Enum "Email Connector", var EmailOutbox: Record "Email Outbox")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message with the details of the recipients and reply to be added. |
| ExternalId | Text |
The external message id that is used to correlate and send the reply. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
| EmailOutbox | Table System.Email."Email Outbox" |
The email outbox which is set up for sending in the background. |
Reply
Sends a reply to an external message id in the foreground.
procedure Reply(EmailMessage: Codeunit "Email Message", EmailAccountId: Guid, EmailConnector: Enum "Email Connector"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message with the details of the recipients and reply to be added. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if sent |
ReplyAll
Sends a reply to an external message id to all recipients on that email in the foreground.
procedure ReplyAll(EmailMessage: Codeunit "Email Message", EmailAccountId: Guid, EmailConnector: Enum "Email Connector"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message with the details of the recipients and reply to be added. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if sent |
EnqueueReply
Sends a reply to an external message id in the background.
procedure EnqueueReply(EmailMessage: Codeunit "Email Message", EmailAccountId: Guid, EmailConnector: Enum "Email Connector", var EmailOutbox: Record "Email Outbox")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message with the details of the recipients and reply to be added. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
| EmailOutbox | Table System.Email."Email Outbox" |
The email outbox which is set up for sending in the background. |
EnqueueReplyAll
Sends a reply to an external message id to all recipients on that email in the foreground.
procedure EnqueueReplyAll(EmailMessage: Codeunit "Email Message", EmailAccountId: Guid, EmailConnector: Enum "Email Connector", var EmailOutbox: Record "Email Outbox")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message with the details of the recipients and reply to be added. |
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
| EmailOutbox | Table System.Email."Email Outbox" |
The email outbox which is set up for sending in the background. |
RetrieveEmails
Obsolete
This element will become obsolete from version 26.0. Replaced by RetrieveEmails with an additional Filters parameter of type Record "Email Retrieval Filters".
Retrieves emails from the email account.
[Obsolete(Replaced by RetrieveEmails with an additional Filters parameter of type Record "Email Retrieval Filters".,26.0)]
procedure RetrieveEmails(EmailAccountId: Guid, EmailConnector: Enum "Email Connector", var EmailInbox: Record "Email Inbox")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
| EmailInbox | Table System.Email."Email Inbox" |
The return record of all new emails that were retrieved. |
RetrieveEmails
Retrieves emails from the email account.
procedure RetrieveEmails(EmailAccountId: Guid, EmailConnector: Enum "Email Connector", var EmailInbox: Record "Email Inbox", var Filters: Record "Email Retrieval Filters" temporary)
Parameters
| Name | Type | Description |
|---|---|---|
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
| EmailInbox | Table System.Email."Email Inbox" |
The return record of all new emails that were retrieved. |
| Filters | Table System.Email."Email Retrieval Filters" |
Filters to be used when retrieving emails. |
MarkAsRead
Marks the specified email as read.
procedure MarkAsRead(EmailAccountId: Guid, EmailConnector: Enum "Email Connector", ExternalId: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| EmailAccountId | Guid |
The ID of the email account to use for sending the email. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use for sending the email. |
| ExternalId | Text |
The external message id that is used to correlate and mark as read. |
OpenInEditor
Opens an email message in "Email Editor" page.
procedure OpenInEditor(EmailMessage: Codeunit "Email Message")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
OpenInEditor
Opens an email message in "Email Editor" page.
procedure OpenInEditor(EmailMessage: Codeunit "Email Message", EmailScenario: Enum "Email Scenario")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailScenario | Enum System.Email."Email Scenario" |
The scenario to use in order to determine the email account to use on the page. |
OpenInEditor
Opens an email message in "Email Editor" page.
procedure OpenInEditor(EmailMessage: Codeunit "Email Message", EmailAccount: Record "Email Account" temporary)
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccount | Table System.Email."Email Account" |
The email account to fill in. |
Remarks
Both "Account Id" and Connector fields need to be set on the EmailAccount parameter.
OpenInEditor
Opens an email message in "Email Editor" page.
procedure OpenInEditor(EmailMessage: Codeunit "Email Message", EmailAccountId: Guid, EmailConnector: Enum "Email Connector")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccountId | Guid |
The ID of the email account to use on the page. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use on the page. |
OpenInEditorModally
Opens an email message in "Email Editor" page modally.
procedure OpenInEditorModally(EmailMessage: Codeunit "Email Message"): Enum "Email Action"
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
Returns
| Type | Description |
|---|---|
| Enum System.Email."Email Action" |
The action that the user performed with the email message. |
OpenInEditorModally
Opens an email message in "Email Editor" page modally.
procedure OpenInEditorModally(EmailMessage: Codeunit "Email Message", EmailScenario: Enum "Email Scenario"): Enum "Email Action"
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailScenario | Enum System.Email."Email Scenario" |
The scenario to use in order to determine the email account to use on the page. |
Returns
| Type | Description |
|---|---|
| Enum System.Email."Email Action" |
The action that the user performed with the email message. |
OpenInEditorModallyWithScenario
Opens an email message in "Email Editor" page modally with scenario.
procedure OpenInEditorModallyWithScenario(EmailMessage: Codeunit "Email Message", EmailAccount: Record "Email Account" temporary, Scenario: Enum "Email Scenario"): Enum "Email Action"
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccount | Table System.Email."Email Account" |
The email account to fill in. |
| Scenario | Enum System.Email."Email Scenario" |
The email scenario to fill in. |
Returns
| Type | Description |
|---|---|
| Enum System.Email."Email Action" |
The action that the user performed with the email message. |
Remarks
Both "Account Id" and Connector fields need to be set on the EmailAccount parameter.
OpenInEditorModally
Opens an email message in "Email Editor" page modally.
procedure OpenInEditorModally(EmailMessage: Codeunit "Email Message", EmailAccount: Record "Email Account" temporary): Enum "Email Action"
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccount | Table System.Email."Email Account" |
The email account to fill in. |
Returns
| Type | Description |
|---|---|
| Enum System.Email."Email Action" |
The action that the user performed with the email message. |
Remarks
Both "Account Id" and Connector fields need to be set on the EmailAccount parameter.
OpenInEditorModally
Opens an email message in "Email Editor" page modally.
procedure OpenInEditorModally(EmailMessage: Codeunit "Email Message", EmailAccountId: Guid, EmailConnector: Enum "Email Connector"): Enum "Email Action"
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message to use as payload. |
| EmailAccountId | Guid |
The ID of the email account to use on the page. |
| EmailConnector | Enum System.Email."Email Connector" |
The email connector to use on the page. |
Returns
| Type | Description |
|---|---|
| Enum System.Email."Email Action" |
The action that the user performed with the email message. |
GetSentEmailsForRecord
Gets the sent emails related to a record.
procedure GetSentEmailsForRecord(TableId: Integer, SystemId: Guid, var ResultSentEmails: Record "Sent Email" temporary)
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID of the record. |
| SystemId | Guid |
The system ID of the record. |
| ResultSentEmails | Table System.Email."Sent Email" |
The table ID of the record. |
GetSentEmailsForRecord
Gets the sent emails related to a record.
procedure GetSentEmailsForRecord(RecordVariant: Variant, var ResultSentEmails: Record "Sent Email" temporary)
Parameters
| Name | Type | Description |
|---|---|---|
| RecordVariant | Variant |
Source Record. |
| ResultSentEmails | Table System.Email."Sent Email" |
The sent email related to a record. |
GetEmailOutboxForRecord
Gets the outbox emails related to a record.
procedure GetEmailOutboxForRecord(RecordVariant: Variant, var ResultEmailOutbox: Record "Email Outbox" temporary)
Parameters
| Name | Type | Description |
|---|---|---|
| RecordVariant | Variant |
Source record. |
| ResultEmailOutbox | Table System.Email."Email Outbox" |
The outbox emails related to a record. |
OpenSentEmails
Open the sent emails page for a source record given by its table ID and system ID.
procedure OpenSentEmails(TableId: Integer, SystemId: Guid)
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID of the record. |
| SystemId | Guid |
The system ID of the record. |
OpenSentEmails
Open the sent emails page for a source record.
procedure OpenSentEmails(RecordVariant: Variant)
Parameters
| Name | Type | Description |
|---|---|---|
| RecordVariant | Variant |
Source record. Can be either Record, RecordRef or RecordId. |
OpenSentEmails
Open the sent emails page for a source record given by its table ID and system ID.
procedure OpenSentEmails(TableId: Integer, SystemId: Guid, NewerThanDate: DateTime)
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID of the source record. |
| SystemId | Guid |
The system ID of the source record. |
| NewerThanDate | DateTime |
The date to which the sent emails are filtered. |
GetOutboxEmailRecordStatus
Gets the outbox email status.
procedure GetOutboxEmailRecordStatus(MessageId: Guid): Enum "Email Status"
Parameters
| Name | Type | Description |
|---|---|---|
| MessageId | Guid |
The MessageId of the record. |
Returns
| Type | Description |
|---|---|
| Enum System.Email."Email Status" |
Email Status of the record. |
AddRelation
Adds a relation between an email message and a record.
procedure AddRelation(EmailMessage: Codeunit "Email Message", TableId: Integer, SystemId: Guid, RelationType: Enum "Email Relation Type", Origin: Enum "Email Relation Origin")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message for which to create the relation. |
| TableId | Integer |
The table ID of the record. |
| SystemId | Guid |
The system ID of the record. |
| RelationType | Enum System.Email."Email Relation Type" |
The relation type to set. |
| Origin | Enum System.Email."Email Relation Origin" |
The origin of when the relation is added to the email. |
RemoveRelation
Removes a related record from an email message.
procedure RemoveRelation(EmailMessage: Codeunit "Email Message", TableId: Integer, SystemId: Guid): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message for which to remove the relation. |
| TableId | Integer |
The table ID of the record. |
| SystemId | Guid |
The system ID of the record. |
Returns
| Type | Description |
|---|---|
| Boolean |
HasRelations
Check if email has any related records linked.
procedure HasRelations(EmailMessage: Codeunit "Email Message"): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message for which to check. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if it has a related records, otherwise false. |
AddDefaultAttachments
Adds the default attachments of a scenario to the email message.
procedure AddDefaultAttachments(EmailMessage: Codeunit "Email Message", EmailScenario: Enum "Email Scenario")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
The email message for which to add the attachments. |
| EmailScenario | Enum System.Email."Email Scenario" |
Includes the default attachments from this scenario. |
Events
OnShowSource
Integration event to show an email source record.
[IntegrationEvent(False,False)]
internal procedure OnShowSource(SourceTableId: Integer, SourceSystemId: Guid, var IsHandled: Boolean)
Parameters
| Name | Type | Description |
|---|---|---|
| SourceTableId | Integer | |
| SourceSystemId | Guid |
The system ID of the source record. |
| IsHandled | Boolean |
Out parameter to set if the event was handled. |
OnAfterAddRelation
Integration event to add additional relations based on added relation to emails.
[IntegrationEvent(False,False)]
internal procedure OnAfterAddRelation(EmailMessageId: Guid, TableId: Integer, SystemId: Guid, var RelatedSystemIds: Dictionary of [Integer, List of [Guid]])
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessageId | Guid |
The ID of the email. |
| TableId | Integer |
Record table id. |
| SystemId | Guid |
Record system id. |
| RelatedSystemIds | Dictionary of [Integer, List of [Guid]] |
Dictionary that contains a list of system ids for each table id, allowing to add related records to the email. |
Remarks
A related record consists of a table id and a system id.
OnAfterRemoveRelation
Integration event to execute code when relation is removed from email.
[IntegrationEvent(False,False)]
internal procedure OnAfterRemoveRelation(EmailMessageId: Guid, TableId: Integer, SystemId: Guid)
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessageId | Guid |
The ID of the email. |
| TableId | Integer |
Record table id. |
| SystemId | Guid |
Record system id. |
OnGetBodyForTestEmail
Integration event to override the default email body for test messages.
[IntegrationEvent(False,False)]
internal procedure OnGetBodyForTestEmail(Connector: Enum "Email Connector", AccountId: Guid, var Body: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| Connector | Enum System.Email."Email Connector" |
The connector used to send the email message. |
| AccountId | Guid |
The account ID of the email account used to send the email message. |
| Body | Text |
Out param to set the email body to a new value. |
OnFindRelatedAttachments
Integration event to get the names and IDs of attachments related to a source record.
[IntegrationEvent(False,False)]
internal procedure OnFindRelatedAttachments(SourceTableId: Integer, SourceSystemID: Guid, var EmailRelatedAttachments: Record "Email Related Attachment" temporary)
Parameters
| Name | Type | Description |
|---|---|---|
| SourceTableId | Integer |
The table number of the source record. |
| SourceSystemID | Guid |
The system ID of the source record. |
| EmailRelatedAttachments | Table System.Email."Email Related Attachment" |
Out parameter to return attachments related to the source record. |
OnGetAttachment
Integration event that requests an attachment to be added to an email.
[IntegrationEvent(False,False)]
internal procedure OnGetAttachment(AttachmentTableID: Integer, AttachmentSystemID: Guid, MessageID: Guid)
Parameters
| Name | Type | Description |
|---|---|---|
| AttachmentTableID | Integer |
The table number of the attachment. |
| AttachmentSystemID | Guid |
The system ID of the attachment. |
| MessageID | Guid |
The ID of the email to add an attachment to. |
OnEnqueuedInOutbox
Integration event to implement additional validation after the email message has been enqueued in the email outbox.
[IntegrationEvent(False,False)]
internal procedure OnEnqueuedInOutbox(MessageId: Guid)
Parameters
| Name | Type | Description |
|---|---|---|
| MessageId | Guid |
The ID of the email that has been queued |
OnEnqueuedReplyInOutbox
Integration event to implement additional validation after the email message has been enqueued in the email outbox.
[IntegrationEvent(False,False)]
internal procedure OnEnqueuedReplyInOutbox(MessageId: Guid)
Parameters
| Name | Type | Description |
|---|---|---|
| MessageId | Guid |
The ID of the email that has been queued |
OnAfterEmailSent
Integration event that notifies senders when the email has been sent successfully. This event is isolated.
[IntegrationEvent(False,False,True)]
internal procedure OnAfterEmailSent(SentEmail: Record "Sent Email")
Parameters
| Name | Type | Description |
|---|---|---|
| SentEmail | Table System.Email."Sent Email" |
The record of the sent email. |
OnAfterEmailSendFailed
Integration event that notifies senders when the email has been sent unsuccessfully. This event is isolated.
[IntegrationEvent(False,False,True)]
internal procedure OnAfterEmailSendFailed(EmailOutbox: Record "Email Outbox")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailOutbox | Table System.Email."Email Outbox" |
The record of the email outbox that failed to send. |
OnBeforeOpenEmailEditor
Integration event that allows updating of the email message before the email editor opens.
[IntegrationEvent(False,False)]
internal procedure OnBeforeOpenEmailEditor(var EmailMessage: Codeunit "Email Message", IsNewEmail: Boolean)
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
Email message codeunit which is linked to the current email. |
| IsNewEmail | Boolean |
True if this is a newly created email. |
OnBeforeSendEmail
Integration event that allows updating of the email message before the email is queued for sending.
[IntegrationEvent(False,False)]
internal procedure OnBeforeSendEmail(var EmailMessage: Codeunit "Email Message")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
Email message codeunit which is linked to the current email. |
OnBeforeReplyEmail
Integration event that allows updating of the email message before the email is queued for replying.
[IntegrationEvent(False,False)]
internal procedure OnBeforeReplyEmail(var EmailMessage: Codeunit "Email Message")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailMessage | Codeunit System.Email."Email Message" |
Email message codeunit which is linked to the current email. |
OnBeforeGetEmailAttachmentsByEmailScenarios
Integration event that allows adding filters to the Email Scenario Attachments before they are retrieved.
[IntegrationEvent(False,False)]
internal procedure OnBeforeGetEmailAttachmentsByEmailScenarios(var EmailScenarioAttachments: Record "Email Scenario Attachments")
Parameters
| Name | Type | Description |
|---|---|---|
| EmailScenarioAttachments | Table System.Email."Email Scenario Attachments" |
The record to add filters to. |