---
id: object/codeunit/8893
type: object
title: Codeunit 8893 "Email Scenario"
summary: Codeunit 8893 "Email Scenario" in System Application (System.Email). 6 public procedures, 1 events. Present since at least BC23, still in BC30, changed in BC24.
tier: official
language: en
tags:
  - codeunit
  - system application
versions:
  introduced: null
  last_changed: "24"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 3dbfc39ceadc1c67870d7a89b7e8563c64951ae0ee1df4591d20a54cf3abe8e2
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/System%20Application/App/Email/src/Scenario/EmailScenario.Codeunit.al
    title: src/System Application/App/Email/src/Scenario/EmailScenario.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 8893
name: Email Scenario
namespace: System.Email
app: System Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "24"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 7
  events: 1
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 1
  called_by: 10
  implements: 0
---

# Codeunit 8893 "Email Scenario"

> Codeunit 8893 "Email Scenario" in System Application (System.Email). 6 public procedures, 1 events. Present since at least BC23, still in BC30, changed in BC24.

System Application · System.Email · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/System%20Application/App/Email/src/Scenario/EmailScenario.Codeunit.al) · facts from BC29

## Events published

- `OnBeforeInsertAvailableEmailScenario(Scenario: Enum "Email Scenario"; var IsAvailable: Boolean)` (integration): Event for changing whether an email scenario should be added to the list of assignable scenarios. If the scenario has already been assigned or is the default scenario, this event won't be published.

## Procedures

- `GetDefaultEmailAccount(var EmailAccount: Record "Email Account"): Boolean`
- `GetEmailAccount(Scenario: Enum "Email Scenario"; var EmailAccount: Record "Email Account"): Boolean`: Gets the email account used by the given email scenario. If the no account is defined for the provided scenario, the default account (if defined) will be returned.
- `IsThereEmailAccountSetForScenario(Scenario: Enum "Email Scenario"): Boolean`: Check if there is an email account set for the given email scenario.
- `SetDefaultEmailAccount(EmailAccount: Record "Email Account")`: Sets a default email account.
- `SetEmailAccount(Scenario: Enum "Email Scenario"; EmailAccount: Record "Email Account")`: Sets an email account to be used by the given email scenario.
- `UnassignScenario(Scenario: Enum "Email Scenario")`: Unassign an email scenario. The scenario will then use the default email account.

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 8892 "Email Scenario Impl."](../codeunit/8892.md) (6 calls: `GetDefaultEmailAccount → GetEmailAccount`, `GetEmailAccount → GetEmailAccount`, `IsThereEmailAccountSetForScenario → IsThereEmailAccountSetForScenario`, …)

## Called by

- [Codeunit 8900 "Email Impl"](../codeunit/8900.md) (3 calls: `Enqueue → GetEmailAccount`, `OpenInEditor → GetEmailAccount`, `Send → GetEmailAccount`)
- [Codeunit 8889 "Email Account Impl."](../codeunit/8889.md) (2 calls: `HandleDefaultAccountDeletion → UnassignScenario`, `MakeDefault → SetDefaultEmailAccount`)
- [Page 9033 "Invite External Accountant"](../page/9033.md) (2 calls: `OnOpenPage → GetEmailAccount`, `SendInvitationEmail → GetEmailAccount`)
- [Codeunit 1034 "Job Planning Line - Calendar"](../codeunit/1034.md) (1 call: `GetOrganizer → GetEmailAccount`)
- [Codeunit 397 "Mail"](../codeunit/397.md) (1 call: `GetDefaultScenarioEmailAddress → GetEmailAccount`)
- [Codeunit 8892 "Email Scenario Impl."](../codeunit/8892.md) (1 call: `GetAvailableScenariosForAccount → OnBeforeInsertAvailableEmailScenario`)
- [Codeunit 8906 "Email Editor"](../codeunit/8906.md) (1 call: `CreateOutbox → GetDefaultEmailAccount`)
- [Codeunit 9520 "Mail Management"](../codeunit/9520.md) (1 call: `QualifyFromAddress → GetEmailAccount`)
- [Page 8886 "Email Account Wizard"](../page/8886.md) (1 call: `OnInit → GetDefaultEmailAccount`)
- [Page 8887 "Email Accounts"](../page/8887.md) (1 call: `UpdateEmailAccounts → GetDefaultEmailAccount`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Email Scenario")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
