Skip to content

src/tool

The send_email Mastra tool: human approval is required by default, with an optional Mastra-native conditional approval function for caller-owned policy. Once allowed, the sender is resolved (explicit from config, else derived from the on-behalf-of user’s email) and the message is dispatched through the shared SMTP transport.

The sender derivation runs inside the AppKit user scope, so getExecutionContext() returns the OBO user whose local-part seeds the address (see deriveSenderAddress).

The dispatch itself goes through the executor the plugin installs on the shared runtime, so a send from this tool picks up the same retry / timeout / telemetry chain as one from the AppKit tool. In a Mastra app with no AppKit plugin registered the send still runs, just without interceptors.