Skip to content

Send email with body

This is the library's general-purpose send operation: it delivers a subject line together with an explicit message body, in HTML or plain text, through the legacy SOAP mail service. It is the operation most application code uses when the outbound message needs actual content rather than just a subject.

Field Value
Operation ID MAIL-OP-002
Trigger Caller invokes Mail.SendMail(inToAddress, inFromAddress, inSubject, inMessage, [isHtml]).
Inputs inToAddress, inFromAddress, inSubject, inMessage, optional isHtml.
Outputs SOAP dispatch to the legacy mail service; the function returns True.
Primary components Mail.SendMail, SAIFMail.clsSAIFMessage, AppGlobal.EnvironmentService
Entry point SAIF.Framework.Mail\MailServices.vb

Steps

  1. Create a new SAIFMail.clsSAIFMessage SOAP client dedicated to this call.
  2. Look up the mail endpoint by calling AppGlobal.EnvironmentService.GetConfigSetting("legacyMailServiceUrl") and assign the result to the proxy's Url property (BR-001).
  3. AppGlobal.EnvironmentService lazily selects WindowsEnvironmentService or WebEnvironmentService depending on whether the call is running inside an HTTP request context.
  4. GetConfigSetting refreshes configuration when it is stale, honors a developer override ahead of the loaded configuration, and returns the resolved setting value.
  5. If the key is absent, the delegated lookup throws before the message is dispatched.

Origin: Steps 2.1–2.3 are implemented in Retrieve a configuration setting (SAIF.Framework.Security.EnvironmentApi) and are executed on behalf of this operation. 3. Select the transmission format from the isHtml flag (BR-002). - When the caller omits isHtml, VB's default-parameter value supplies True. - If isHtml is True, call SendMail(inToAddress, inFromAddress, inSubject, inMessage). - If isHtml is False, call SendMailAsText(inToAddress, inFromAddress, inSubject, inMessage). 4. Dispose the SOAP proxy and clear the module-level reference. 5. Return True once the dispatch path completes (BR-003). - On failure: exceptions raised during endpoint resolution or the SOAP call propagate unchanged to the caller, since this function has no local error handling.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([SendMail body call]) --> Proxy[Create clsSAIFMessage]
    Proxy --> Url[Resolve legacyMailServiceUrl]
    Url --> Html{isHtml?}
    Html -->|True| HtmlSend[Call SendMail with body]
    Html -->|False| TextSend[Call SendMailAsText with body]
    HtmlSend --> Dispose[Dispose proxy]
    TextSend --> Dispose
    Dispose --> End([Return True])

Failure and edge-case behavior

  • inMessage is forwarded to the SOAP proxy exactly as supplied; the library performs no local validation, trimming, encoding adjustment, or disclaimer insertion on the body text.
  • Configuration lookup failures and SOAP-layer failures both surface as unhandled exceptions, since no recovery logic exists anywhere in this call path.
  • Reaching the final Return True statement is the only success signal this function produces; it does not reflect any acknowledgement returned by the remote mail service.

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