Table of Contents

Codeunit "Email Account"

ID 8894
Namespace: System.Email

Provides functionality to work with email accounts.

Properties

Name Value
Access Public

Methods

GetAllAccounts

Gets all of the email accounts registered in Business Central.

procedure GetAllAccounts(LoadLogos: Boolean, var TempEmailAccount: Record "Email Account" temporary)

Parameters

Name Type Description
LoadLogos Boolean

Flag, used to determine whether to load the logos for the accounts.

TempEmailAccount Table System.Email."Email Account"

Out parameter holding the email accounts.

GetAllAccounts

Gets all of the email accounts registered in Business Central.

procedure GetAllAccounts(var TempEmailAccount: Record "Email Account" temporary)

Parameters

Name Type Description
TempEmailAccount Table System.Email."Email Account"

Out parameter holding the email accounts.

IsAnyAccountRegistered

Checks if there is at least one email account registered in Business Central.

procedure IsAnyAccountRegistered(): Boolean

Returns

Type Description
Boolean

True if there is any account registered in the system, otherwise - false.

IsAccountRegistered

Checks if a specific email account is registered in Business Central.

procedure IsAccountRegistered(EmailAccountId: Guid, EmailConnector: Enum "Email Connector"): Boolean

Parameters

Name Type Description
EmailAccountId Guid

The email account ID

EmailConnector Enum System.Email."Email Connector"

The email connector

Returns

Type Description
Boolean

DeleteAccounts

Deletes all selected email accounts.

procedure DeleteAccounts(var TempEmailAccountsToDelete: Record "Email Account" temporary, HideDialog: Boolean)

Parameters

Name Type Description
TempEmailAccountsToDelete Table System.Email."Email Account"

Holding the selected email accounts to delete.

HideDialog Boolean

Hides any confirmation or interaction that involves a UI.

ValidateEmailAddress

Validates an email address and throws an error if it is invalid.

[TryFunction]
procedure ValidateEmailAddress(EmailAddress: Text): Boolean

Parameters

Name Type Description
EmailAddress Text

The email address to validate.

Returns

Type Description
Boolean

True if the email address is valid; false otherwise.

Remarks

If the provided email address is an empty string, the function will do nothing.

ValidateEmailAddress

Validates an email address and throws an error if it is invalid.

[TryFunction]
procedure ValidateEmailAddress(EmailAddress: Text, AllowEmptyValue: Boolean): Boolean

Parameters

Name Type Description
EmailAddress Text

The email address to validate.

AllowEmptyValue Boolean

Indicates whether to skip the validation if the provided email address is empty.

Returns

Type Description
Boolean

True if the email address is valid; false otherwise.

ValidateEmailAddresses

Validates email addresses and displays an error if any are invalid.

[TryFunction]
procedure ValidateEmailAddresses(EmailAddresses: Text): Boolean

Parameters

Name Type Description
EmailAddresses Text

The email addresses to validate, separated by semicolons.

Returns

Type Description
Boolean

True if all email addresses are valid; false otherwise.

Remarks

If the provided email address is an empty string, the function will do nothing.

ValidateEmailAddresses

Validates email addresses and displays an error if any are invalid.

[TryFunction]
procedure ValidateEmailAddresses(EmailAddresses: Text, AllowEmptyValue: Boolean): Boolean

Parameters

Name Type Description
EmailAddresses Text

The email addresses to validate, separated by semicolons.

AllowEmptyValue Boolean

Indicates whether to skip the validation if no email address is provided.

Returns

Type Description
Boolean

True if all email addresses are valid; false otherwise.

Events

OnAfterValidateEmailAddress

[IntegrationEvent(False,False)]
internal procedure OnAfterValidateEmailAddress(EmailAddress: Text, AllowEmptyValue: Boolean)

Parameters

Name Type Description
EmailAddress Text
AllowEmptyValue Boolean

OnAfterDeleteEmailAccount

[IntegrationEvent(False,False)]
internal procedure OnAfterDeleteEmailAccount(EmailAccountId: Guid, EmailAccountConnector: Enum "Email Connector")

Parameters

Name Type Description
EmailAccountId Guid
EmailAccountConnector Enum System.Email."Email Connector"

See also