Send email with options¶
This operation is the richest send path in the library: it targets the SendEmail SOAP method, which — unlike the plain SendMail/SendMailAsText methods — accepts arrays of attachments and linked resources (such as inline images referenced from an HTML body). The two public overloads differ only in whether the caller supplies a message body; both funnel into the same dispatch logic.
| Field | Value |
|---|---|
| Operation ID | MAIL-OP-003 |
| Trigger | Caller invokes either Mail.SendMailWithOptions(...) overload. |
| Inputs | inToAddress, inFromAddress, inSubject, optional inMessage, isHtml, optional SAIFMail.clsAttachment() and SAIFMail.clsLinkedResource() arrays. |
| Outputs | SOAP dispatch to SendEmail; the function returns True. |
| Primary components | Mail.SendMailWithOptions, SAIFMail.clsSAIFMessage, AppGlobal.EnvironmentService |
| Entry point | SAIF.Framework.Mail\MailServices.vb |
Steps¶
- If the caller used the overload that omits
inMessage, delegate immediately to the full overload, passingString.Emptyas the body. - In the full overload, create a new
SAIFMail.clsSAIFMessageSOAP client. - Look up the mail endpoint by calling
AppGlobal.EnvironmentService.GetConfigSetting("legacyMailServiceUrl")and assign the result to the proxy'sUrlproperty (BR-001). AppGlobal.EnvironmentServicelazily selects the environment-service implementation appropriate to the current host context.GetConfigSettingrefreshes configuration as needed and returns the resolvedlegacyMailServiceUrlvalue from overrides or cached configuration.- If the key cannot be resolved, execution ends by exception before
SendEmailis ever invoked.
Origin: Steps 3.1–3.3 are implemented in Retrieve a configuration setting (
SAIF.Framework.Security.EnvironmentApi) and are executed on behalf of this operation. 4. CallSendEmail(inToAddress, inFromAddress, inSubject, inMessage, isHtml, attachments, linkedResources). -attachmentsandlinkedResourcesare forwarded to the SOAP proxy exactly as supplied — the operation performs no local inspection, deduplication, or size validation of either array. - If either optional array isNothing, thatNothingvalue passes through to the proxy unchanged. 5. Dispose the SOAP proxy and clear the module-level reference. 6. ReturnTrueonce the dispatch path completes (BR-003). - On failure: exceptions from configuration lookup or the SOAP call propagate to the caller, because this method has noTry...Catchblock.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([SendMailWithOptions call]) --> Body{Message overload used?}
Body -->|No body overload| Delegate[Delegate with String.Empty]
Body -->|Body overload| Proxy[Create clsSAIFMessage]
Delegate --> Proxy
Proxy --> Url[Resolve legacyMailServiceUrl]
Url --> Send[Call SendEmail]
Send --> Dispose[Dispose proxy]
Dispose --> End([Return True])
Failure and edge-case behavior¶
- Neither the attachment array nor the linked-resource array is normalized, deduplicated, or size-checked before it reaches the SOAP proxy; any such validation would have to happen on the caller's side.
- The no-body overload adds no behavior of its own beyond substituting
String.Emptybefore delegating to the full overload. - There is no fallback or retry logic in
MailServices.vbif endpoint resolution fails — the operation simply fails outward to the caller.
Related documentation¶
- Operations and processes
- Overview
- Architecture
- Dependencies
- Business rules
- Configuration
- API reference
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