SAIF.Framework.Mail operations and processes¶
SAIF.Framework.Mail exposes six operations through the shared Mail module: four public send operations that dispatch messages through the legacy clsSAIFMessage.asmx SOAP service, and two internal byte-conversion helpers that the attachment-sending operation relies on to turn a stream or a file into a payload the SOAP proxy can transmit. This page is the operation catalog and cross-operation hub for this library. Each operation's detailed, step-by-step logic lives in its own page under operations/.
Operation catalog¶
| Operation | Intent | Trigger | Inputs | Outputs | Rules | Tables | SQL |
|---|---|---|---|---|---|---|---|
| Send subject-only email | Send a message that carries only recipients and a subject, with no body text | Caller invokes Mail.SendMail(inToAddress, inFromAddress, inSubject, [isHtml]) |
Recipient address, sender address, subject, optional HTML flag | One SendMail/SendMailAsText SOAP request; function returns True |
BR-001, BR-002, BR-003 | — | — |
| Send email with body | Send a message that includes an explicit body | Caller invokes Mail.SendMail(inToAddress, inFromAddress, inSubject, inMessage, [isHtml]) |
Recipient address, sender address, subject, message body, optional HTML flag | One SendMail/SendMailAsText SOAP request; function returns True |
BR-001, BR-002, BR-003 | — | — |
| Send email with options | Send a message that may carry attachments and/or linked resources | Caller invokes either overload of Mail.SendMailWithOptions(...) |
Recipient address, sender address, subject, optional message body, HTML flag, optional attachment/linked-resource arrays | One SendEmail SOAP request; function returns True |
BR-001, BR-003 | — | — |
| Send email with attachment | Send a message that carries exactly one attachment, regardless of how the caller supplied it | Caller invokes any overload of Mail.SendMailWithAttachment(...) |
Recipient address, sender address, subject, optional message body, one attachment source (Stream, file path, or Byte()), attachment name |
Attachment converted to bytes when needed; one SendWithAttach SOAP request; function returns True |
BR-001, BR-003, BR-004, BR-005 | — | — |
| Read a file into bytes | Convert a file on disk into the byte payload the SOAP proxy expects for an attachment | Attachment pipeline calls GetFileAsBytes(inPath) |
File system path | Byte() payload, or a propagated exception |
BR-004 | — | — |
| Read a stream into bytes | Convert a stream into the byte payload the SOAP proxy expects for an attachment | Attachment pipeline calls GetStreamAsBytes(inStream) |
Open Stream reference (or Nothing) |
Byte() payload, or Nothing when no stream was supplied |
BR-005 | — | — |
Process flow diagram¶
The following diagram visualizes how a caller's choice of send operation and attachment source funnels into a single dispatch-and-return pattern shared by every operation in this library.
flowchart TD
Start([Caller invokes a Mail send operation]) --> Select[Select send overload]
Select --> Resolve[Resolve legacyMailServiceUrl]
Resolve --> Attachment{Attachment source supplied?}
Attachment -->|No| Dispatch[Call SendMail / SendMailAsText / SendEmail]
Attachment -->|Stream| StreamBytes[Read stream into bytes]
Attachment -->|File path| FileBytes[Read file into bytes]
Attachment -->|Byte array| DispatchAttach[Call SendWithAttach]
StreamBytes --> DispatchAttach
FileBytes --> DispatchAttach
Dispatch --> Dispose[Dispose SOAP proxy]
DispatchAttach --> Dispose
Dispose --> Done([Return True])
Inherited operations and processes¶
Operations in this section originate from base classes or services provided by dependency framework libraries. They are inherited or delegated, not implemented in this library.
From EnvironmentServiceBase (SAIF.Framework.Security.EnvironmentApi)¶
| Operation | Intent | Provided by | Origin | Embedded in |
|---|---|---|---|---|
| Retrieve a configuration setting | Resolve legacyMailServiceUrl from developer overrides, cached configuration, or the loaded Environment API configuration |
IEnvironmentService.GetConfigSetting |
SAIF.Framework.Security.EnvironmentApi |
Send subject-only email, Send email with body, Send email with options, Send email with attachment |
Origin: This operation is defined in SAIF.Framework.Security.EnvironmentApi and its step-by-step logic is embedded inline (with
> Origincallouts) in the consuming operation detail pages.
Failure and edge-case behavior¶
- Every send operation returns
Trueonce its dispatch path completes; none of them inspects a response value from the remote service, so the return value cannot be used to detect a silent delivery failure. GetFileAsBytesandGetStreamAsBytesboth size their buffers usingLengthas a VB array upper bound rather than an element count, so each resulting byte array carries one extra, zero-initialized trailing byte.GetStreamAsBytesreads starting at the stream's current position rather than rewinding it first, so a partially consumed stream produces a payload that is only partially populated.GetFileAsBytescloses itsFileStreamunconditionally in aFinallyblock; if the stream is never successfully opened, that cleanup step can itself raise aNullReferenceException.
Related documentation¶
Sources¶
- SAIF.Framework.Mail\MailServices.vb
- SAIF.Framework.Mail\Web References\SAIFMail\Reference.vb
- SAIF.Framework.Security\AppGlobal.vb
- SAIF.Framework.Security.EnvironmentApi\Core\Services\IEnvironmentService.cs
- SAIF.Framework.Security.EnvironmentApi\Services.Common\EnvironmentServiceBase.cs