---
title: Send mail through the legacy mail service
summary: Dispatches outbound mail, with optional attachment, via the legacy SAIF SOAP mail web service.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Core.Infragistics111
reference_type: package
operation_id: OP-CORE-007
trigger: Called by consuming applications/models
---

# Send mail through the legacy mail service

This operation dispatches outbound e-mail through the legacy SAIF mail SOAP web service, whose endpoint URL is resolved from configuration on every call. Six overloads support plain messages and attachments supplied as a stream, byte array, or file path.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-CORE-007 |
| **Trigger** | Called by consuming applications/models |
| **Inputs** | To address, from address, subject, optional body, optional attachment (stream, byte array, or file path) and attachment name |
| **Outputs** | Mail dispatched by the remote service |
| **Primary components** | `Utilities.clsMailMessage.SendMail`, `Utilities.clsMailMessage.SendMailWithAttachment` |
| **Entry point** | `SAIF.Presentation.Web.Core.Infragistics111/clsMailMessage.vb` |

## Steps

1. Create a `SAIFMail.clsSAIFMessage` SOAP client instance.
2. Set the client's `Url` from `AppGlobal.EnvironmentService.GetConfigSetting("LegacyMailWebServiceUrl")`. ([BR-CORE-024](../business-rules.md#br-core-024-outbound-mail-is-sent-through-the-legacy-mail-web-service-whose-url-comes-from-the-legacymailwebserviceurl-configuration-setting))
   - > **Origin**: Delegates to the SAIF framework environment service (`AppGlobal.EnvironmentService`, package `SAIF.BOF.Framework`); the callee's own configuration-resolution steps are not visible from this repository.**
   - No null/empty guard surrounds this call — a missing setting produces an unusable proxy URL at send time.*
3. For attachment overloads, materialize the attachment as a byte array:
   - If supplied as a file path: call `GetFileAsBytes`.
   - If supplied as a stream: call `GetStreamAsBytes`.
4. Invoke the remote `SendMail` / `SendMailWithAttachment` SOAP operation with the assembled parameters.
5. Dispose the SOAP client and null the reference.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([SendMail / SendMailWithAttachment called]) --> S1[Create SAIFMail.clsSAIFMessage client]
	S1 --> S2[Set Url from LegacyMailWebServiceUrl]
	S2 --> S3{Attachment supplied?}
	S3 -->|File path| S4[GetFileAsBytes]
	S3 -->|Stream| S5[GetStreamAsBytes]
	S3 -->|None| S6[No attachment payload]
	S4 --> S7[Invoke remote SendMail operation]
	S5 --> S7
	S6 --> S7
	S7 --> S8[Dispose client, null reference]
```

## Failure and edge-case behavior
- The `SendMail` / `SendMailWithAttachment` overloads are declared `As Boolean` but contain no `Return` statement, so they always yield `False` regardless of whether the mail was actually dispatched.* Callers that branch on the return value will always take the failure path.
- `LegacyMailWebServiceUrl` is resolved on every call rather than cached, making mail delivery sensitive to environment-service availability at send time.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `SAIF.Presentation.Web.Core.Infragistics111/clsMailMessage.vb`
