Skip to content

Codeunit WSB_DMTMailTemplateFile

Reads and writes Document Mail Template files (.dmt). A mail template file holds the email subject and body for the default language and, optionally, a variant per language: ...... Languages are identified by their ISO language tag (culture name), for example "nl-NL". Contents that are not a mail template file are treated as the email body for the default language, so that mail templates created before language variants were supported keep working.

Properties

Name Value
Access Public

Methods

wgFncGetBody

Returns the email body that applies for a language. If there is no variant for the language, the variant for its primary language is used, and otherwise the default variant.

Parameters

Type Name Description
Text pTemplateFile The contents of the mail template file.
Text pLanguageTag The ISO language tag of the language, for example "nl-BE".

Returns

Type Description
Text The email body as HTML.

wgFncGetBodyForLanguage

Returns the email body that is stored for a specific language, without falling back on another language.

Parameters

Type Name Description
Text pTemplateFile The contents of the mail template file.
Text pLanguageTag The ISO language tag of the language, or an empty value for the default variant.
Text vBody The email body as HTML.

Returns

Type Description
Boolean true iff a variant exists for the language.

wgFncGetLanguageSummary

Returns the languages of a mail template file as a readable list, for example "Default, Dutch (Netherlands), German (Germany)".

Parameters

Type Name Description
Text pTemplateFile The contents of the mail template file.

Returns

Type Description
Text The languages as text.

wgFncGetLanguageTagFilter

Returns a language tag filter for all translations of a mail template file.

Parameters

Type Name Description
Text pTemplateFile The contents of the mail template file.

wgFncGetLanguageTags

Returns the ISO language tags of the language variants in a mail template file.

Parameters

Type Name Description
Text pTemplateFile The contents of the mail template file.
List vLanguageTags The ISO language tags, excluding the default variant.

wgFncGetSubject

Returns the email subject that applies for a language. If there is no variant for the language, the variant for its primary language is used, and otherwise the default variant.

Parameters

Type Name Description
Text pTemplateFile The contents of the mail template file.
Text pLanguageTag The ISO language tag of the language, for example "nl-BE".

Returns

Type Description
Text The email subject, which is empty when the mail template does not specify one.

wgFncGetSubjectForLanguage

Returns the email subject that is stored for a specific language, without falling back on another language.

Parameters

Type Name Description
Text pTemplateFile The contents of the mail template file.
Text pLanguageTag The ISO language tag of the language, or an empty value for the default variant.
Text vSubject The email subject.

Returns

Type Description
Boolean true iff a subject is stored for the language.

wgFncRemoveBody

Removes the language variant for a language from a mail template file.

Parameters

Type Name Description
Text pTemplateFile The contents of the mail template file.
Text pLanguageTag The ISO language tag of the language to remove.

Returns

Type Description
Text The new contents of the mail template file.

wgFncSetBody

Stores the email body for a language in a mail template file.

Parameters

Type Name Description
Text pTemplateFile The contents of the mail template file.
Text pLanguageTag The ISO language tag of the language, or an empty value for the default variant.
Text pBody The email body as HTML.

Returns

Type Description
Text The new contents of the mail template file.

wgFncSetSubject

Stores the email subject for a language in a mail template file.

Parameters

Type Name Description
Text pTemplateFile The contents of the mail template file.
Text pLanguageTag The ISO language tag of the language, or an empty value for the default variant.
Text pSubject The email subject.

Returns

Type Description
Text The new contents of the mail template file.