---
title: "Codeunit 260 Document-Mailing"
author: "Jonas Paprotka"
url: https://jonas-paprotka.de/ref/codeunit/260-document-mailing/
type: codeunit
id: 260
name: "Document-Mailing"
app: "Base Application"
namespace: System.EMail
versions: "17-28"
build: 28.5.54151.54365
source: "https://jonas-paprotka.de/ref/codeunit/260-document-mailing/source/29/"
checked: 2026-09-20
subject: "Microsoft Dynamics 365 Business Central"
license: "Content © 2026 Jonas Paprotka. Quote freely with attribution and a link."
---

# Codeunit 260 Document-Mailing

Jonas Paprotka, https://jonas-paprotka.de/ref/codeunit/260-document-mailing/

| | |
| --- | --- |
| App | Base Application |
| Namespace | System.EMail |
| Versions | 17-28 |
| Source file | DocumentMailing.Codeunit.al |

## Procedures

| Name | Parameters | Returns | Access | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- | --- |
| EmailFile | (InStream, Text, Text, Text, Text, Boolean, Enum Email Scenario) | Boolean | public | 17-28 | Pending 27.0 | Use procedure EmailFile that accepts a "Temp Blob" for the html body instead. |
| EmailFile | (InStream, Text, Text[250], Code[20], Text[250], Text[250], Boolean, Integer) | Boolean | public | 17-28 | Pending 27.0 | Use procedure EmailFile that accepts a "Temp Blob" for the html body instead. |
| EmailFile | (Text[250], Text[250], Text[250], Code[20], Text[250], Text[250], Boolean, Integer) | Boolean | public | 17-22 | Pending 17.2 | Replaced by an overload that supports streams. |
| EmailFile | (Text, Text, Text, Text, Text, Boolean, Enum Email Scenario) | Boolean | public | 17-22 | Pending 17.2 | Replaced by an overload that supports streams. |
| EmailFileWithSubject | (Text, Text, Text, Text, Text, Boolean) | Boolean | public | 17-22 | Pending 17.0 | Replaced with the EmailFile function accepting Email Scenario |
| EmailFileWithSubjectAndSender | (Text, Text, Text, Text, Text, Boolean, Code[50]) | Boolean | public | 17-22 | Pending 17.0 | Replaced with the EmailFile function accepting Email Scenario |
| EmailFileWithSubjectAndReportUsage | (Text[250], Text[250], Text[250], Text[250], Code[20], Text[250], Text[250], Boolean, Integer) | Boolean | public | 17-22 | Pending 17.2 | Replaced by an overload that supports streams. |
| EmailFileWithSubjectAndReportUsage | (InStream, Text, Text[250], Text[250], Code[20], Text[250], Text[250], Boolean, Integer) | Boolean | public | 17-28 | Pending 27.0 | Use procedure EmailFileWithSubjectAndReportUsage that accepts a "Temp Blob" for the html body instead. |
| GetToAddressFromCustomer | (Code[20]) | Text[250] | public | 17-28 | - | - |
| GetToAddressFromVendor | (Code[20]) | Text[250] | public | 17-28 | - | - |
| GetAttachmentFileName | (var Text[250], Code[20], Text[250], Integer) | - | public | 17-28 | - | - |
| GetEmailBody | (Code[20], Integer, Code[20]) | Text | public | 17-28 | - | - |
| ReplaceCustomerNameWithPlaceholder | (Code[20], Text) | Text | public | 17-28 | - | - |
| GetEmailSubject | (Code[20], Text[250], Integer) | Text[250] | public | 17-28 | - | - |
| GetTestInvoiceEmailBody | (Code[20]) | Text | public | 17-23 | Pending 21.0 | Microsoft Invoicing has been discontinued. |
| GetTestInvoiceEmailSubject | () | Text[250] | public | 17-23 | Pending 21.0 | Microsoft Invoicing has been discontinued. |
| SendQuoteInForeground | (Record Sales Header) | Boolean | public | 17-23 | Pending 21.0 | Microsoft Invoicing has been discontinued. |
| SendPostedInvoiceInForeground | (Record Sales Invoice Header) | Boolean | public | 17-23 | Pending 21.0 | Microsoft Invoicing has been discontinued. |
| EmailFileFromStream | (InStream, Text, Text, Text, Text, Boolean, Integer) | Boolean | public | 17-28 | - | - |
| EmailHtmlFromStream | (InStream, Text[250], Text, Boolean, Integer) | Boolean | public | 17-28 | - | - |
| EmailFileAndHtmlFromStream | (InStream, Text, InStream, Text[250], Text, Boolean, Integer) | Boolean | public | 17-28 | - | - |
| EmailFileAndHtmlFromStream | (InStream, Text, InStream, Text[250], Text, Boolean, Integer, Code[20], Boolean) | Boolean | public | 17-28 | - | - |
| EmailFile | (InStream, Text, Text, Text, Text, Boolean, Enum Email Scenario, RecordRef) | Boolean | public | 18-28 | Pending 27.0 | Use procedure EmailFile that accepts a "Temp Blob" for the html body instead. |
| EmailFile | (InStream, Text, Text, Text, Text, Boolean, Enum Email Scenario, List, List, List) | Boolean | public | 18-28 | Pending 27.0 | Use procedure EmailFile that accepts a "Temp Blob" for the html body instead. |
| EmailFile | (InStream, Text, Text[250], Code[20], Text[250], Text[250], Boolean, Integer, RecordRef) | Boolean | public | 18-28 | Pending 27.0 | Use procedure EmailFile that accepts a "Temp Blob" for the html body instead. |
| EmailFile | (InStream, Text, InStream, Text, Text, Boolean, Enum Email Scenario, List, List, List) | Boolean | public | 18-28 | - | - |
| EmailFile | (InStream, Text, Text[250], Code[20], Text[250], Text[250], Boolean, Integer, List, List, List) | Boolean | public | 18-28 | Pending 27.0 | Use procedure EmailFile that accepts a "Temp Blob" for the html body instead. |
| EmailFile | (InStream, Text, InStream, Code[20], Text[250], Text[250], Boolean, Integer, List, List, List) | Boolean | public | 18-28 | - | - |
| EmailFileWithSubjectAndReportUsage | (InStream, Text, Text[250], Text[250], Code[20], Text[250], Text[250], Boolean, Integer, RecordRef) | Boolean | public | 18-28 | Pending 27.0 | Use procedure EmailFileWithSubjectAndReportUsage that accepts a "Temp Blob" for the html body instead. |
| EmailFileWithSubjectAndReportUsage | (InStream, Text, Text[250], Text[250], Code[20], Text[250], Text[250], Boolean, Integer, List, List, List) | Boolean | public | 18-28 | Pending 27.0 | Use procedure EmailFileWithSubjectAndReportUsage that accepts a "Temp Blob" for the html body instead. |
| EnqueueEmailFile | (InStream, Text, Text[250], Code[20], Text[250], Text[250], Boolean, Integer, List, List, List) | Boolean | internal | 23-26 | - | - |
| EnqueueEmailFile | (InStream, Text, Code[20], Text[250], Text[250], Boolean, Integer, List, List, List) | Boolean | internal | 27-28 | - | - |
| EmailFile | (InStream, Text, var Codeunit Temp Blob, Text, Text, Boolean, Enum Email Scenario) | Boolean | public | 27-28 | - | - |
| EmailFile | (InStream, Text, var Codeunit Temp Blob, Code[20], Text[250], Text[250], Boolean, Integer) | Boolean | public | 27-28 | - | - |
| EmailFile | (InStream, Text, var Codeunit Temp Blob, Text, Text, Boolean, Enum Email Scenario, RecordRef) | Boolean | public | 27-28 | - | - |
| EmailFile | (InStream, Text, var Codeunit Temp Blob, Text, Text, Boolean, Enum Email Scenario, List, List, List) | Boolean | public | 27-28 | - | - |
| EmailFile | (InStream, Text, var Codeunit Temp Blob, Code[20], Text[250], Text[250], Boolean, Integer, RecordRef) | Boolean | public | 27-28 | - | - |
| EmailFile | (InStream, Text, var Codeunit Temp Blob, Code[20], Text[250], Text[250], Boolean, Integer, List, List, List) | Boolean | public | 27-28 | - | - |
| EmailFile | (InStream, Text, var Codeunit Temp Blob, Text[250], Code[20], Text[250], Text[250], Boolean, Integer, List, List, List) | Boolean | public | 27-28 | - | - |
| EmailFileWithSubjectAndReportUsage | (InStream, Text, var Codeunit Temp Blob, Text[250], Code[20], Text[250], Text[250], Boolean, Integer) | Boolean | public | 27-28 | - | - |
| EmailFileWithSubjectAndReportUsage | (InStream, Text, var Codeunit Temp Blob, Text[250], Code[20], Text[250], Text[250], Boolean, Integer, RecordRef) | Boolean | public | 27-28 | - | - |
| EmailFileWithSubjectAndReportUsage | (InStream, Text, var Codeunit Temp Blob, Text[250], Code[20], Text[250], Text[250], Boolean, Integer, List, List, List) | Boolean | public | 27-28 | - | - |

## Events

| Kind | Name | Parameters | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- |
| Integration event | OnBeforeSendEmail | (var Record Email Item, var Boolean, var Code[20], var Boolean, var Integer, var Boolean, var Boolean, Text[250], Code[50], Enum Email Scenario) | 17-28 | - | - |
| Integration event | OnAfterEmailSentSuccesfully | (var Record Email Item, Code[20], Integer) | 17-28 | - | - |
| Integration event | OnBeforeEmailFileInternal | (var Record Email Item, var Text[250], var Text[250], var Text[250], var Code[20], var Text[250], var Boolean, var Integer, var Boolean, var Code[50], var Enum Email Scenario) | 17-20 | - | - |
| Integration event | OnBeforeGetAttachmentFileName | (var Text[250], Code[20], Text[250], Integer) | 17-28 | - | - |
| Integration event | OnBeforeGetEmailSubject | (Code[20], Text[250], Integer, var Text[250], var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeGetToAddressFromCustomer | (Code[20], var Text[250], var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeGetToAddressFromVendor | (Code[20], var Text[250], var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeEmailFileInternal | (var Record Email Item, var Text[250], var Text[250], var Text[250], var Code[20], var Text[250], var Boolean, var Integer, var Boolean, var Code[50], var Enum Email Scenario, var Boolean, var Boolean) | 21-28 | Pending 27.0 | Use new Event OnBeforeEmailItemPreparation instead. |
| Integration event | OnBeforeEmailFile | (var Boolean) | 21-28 | - | - |
| Integration event | OnAfterEmailSent | (var Record Email Item, Code[20], Integer, Boolean) | 24-28 | - | - |
| Integration event | OnAfterGetEmailSubject | (Code[20], Text[250], Integer, var Text[250]) | 24-28 | - | - |
| Integration event | OnAfterGetAttachmentFileName | (var Text[250], Code[20], Text[250], Integer) | 25-28 | - | - |
| Integration event | OnBeforeEmailItemPreparation | (var Record Email Item, var Codeunit Temp Blob, var Text[250], var Text[250], var Code[20], var Text[250], var Boolean, var Integer, var Boolean, var Code[50], var Enum Email Scenario, var Boolean, var Boolean) | 27-28 | - | - |

## Source

Symbols: Microsoft.BaseApplication.symbols.437dbf0e-84ff-417a-965d-ed2bb9650972, https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSSymbols/nuget/v3/index.json, highest build per major on 2026-09-20.
AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at a66254c3b8b5bb1cea290dc8f9d097aec4381153.

Jonas Paprotka, 2026-09-20.
