Skip to content
Corven Email SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

Microsoft Graph

Submit through a Microsoft Graph mailbox using a host-acquired access token.

Import graphEmailLayer from @corven/email-sdk/graph to provide the common Email service for this account.

Configure the account

import { Layer } from "effect";
import type { Redacted } from "effect";
import { graphEmailLayer } from "@corven/email-sdk/graph";
import { emailHttpLayer } from "./sending.js";

export const configuredGraphAccount = (accessToken: Redacted.Redacted) =>
  graphEmailLayer({
    accessToken,
    mailboxId: "00000000-0000-4000-8000-000000000001",
    mailboxAddress: "sender@example.test",
    senderIdentity: "OwnerOrSendAs",
    mailFlow: "ProviderUnmodified",
    sentItems: "Save",
  }).pipe(Layer.provide(emailHttpLayer));

The example reuses the explicit HTTP Layer. Acquire credentials in trusted host code, then provide this account Layer to your sending program.

Message behavior

  • The host acquires and refreshes accessToken. This adapter does not implement OAuth client credentials, managed identity discovery or token refresh.
  • Provide the mailbox UUID and address, attest OwnerOrSendAs permission and unmodified mail flow, and choose Save or DoNotSave for sent items.
  • Graph represents one body format; incompatible dual-body intent is rejected instead of dropping a body. Common metadata, tags and scheduling are unsupported.
  • An accepted sendMail response can omit the message ID. Store the receipt without adding an ID.

Idempotency

Idempotency keys are not supported. The SDK does not retry sendMail requests with unknown submission outcomes.

Read field support before switching accounts, and receipts and retries before adding recovery behavior. Configuration and local validation do not authenticate the account or prove delivery.