Skip to content

Open an e-mail compose window from the browser

This operation registers client-side script that opens the user's default e-mail client via a mailto: URL, sanitizing recipient and subject text before they are placed in the URL.

Field Value
Operation ID OP-CORE-008
Trigger Consuming page action
Inputs Recipient, optional CC, subject, body
Outputs Registered client script that opens a mailto: window
Primary components AppViewPageBase.OpenEmailPopup, AppViewPageBase.OpenEmailScriptManager
Entry point SAIF.Presentation.Web.Core.Infragistics111/AppViewPageBase.aspx.vb

Steps

  1. Sanitize the recipient and subject via Utilities.clsStringUtilities.CleanForEmail. (BR-CORE-025)
  2. Origin: Sanitization logic is implemented in Clean text for output (SAIF.Presentation.Web.Core.Infragistics111, this library).

  3. Note: the body sanitization call is commented out in source and is therefore not active.*
  4. Format the mailto: string:
  5. If no CC was supplied: mailto:{0}?subject={1}&body={2}.
  6. If a non-empty CC was supplied: mailto:{0}?cc={1}&subject={2}&body={3}. (BR-CORE-026)
  7. Register the resulting window.open(...) script:
  8. Via ClientScript for the popup variant (OpenEmailPopup).
  9. Via ScriptManager.RegisterClientScriptBlock for the partial-postback variant (OpenEmailScriptManager).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Consuming page action]) --> S1[CleanForEmail: sanitize recipient and subject]
    S1 --> S2{Non-empty CC supplied?}
    S2 -->|Yes| S3["Format mailto: with cc="]
    S2 -->|No| S4["Format mailto: without cc="]
    S3 --> S5{Popup or partial-postback variant?}
    S4 --> S5
    S5 -->|Popup| S6[Register via ClientScript]
    S5 -->|Partial postback| S7[Register via ScriptManager.RegisterClientScriptBlock]

Failure and edge-case behavior

  • Body text is not sanitized (the sanitization call for body is commented out), so body content placed in the mailto: URL is not passed through CleanForEmail.*
  • Neither overload validates that the recipient is a well-formed e-mail address before building the mailto: string.

Sources

  • SAIF.Presentation.Web.Core.Infragistics111/AppViewPageBase.aspx.vb