Skip to content

transport

The email runtime: a lazily-built, process-wide dispatcher plus its resolved config, and sendEmail which sends one EmailMessage through it. In SMTP mode the runtime holds a memoized nodemailer transport (shared by the plugin’s setup and the agent tool, so they reuse one connection pool); in file/outbox mode it holds no transport and sendEmail writes HTML to disk instead. The first caller (normally the plugin at setup) primes it with the plugin’s config; later callers reuse it.

The runtime also carries the EmailExecutor every outbound send runs through. The plugin installs its own execute() there at setup, which is how the Mastra tool - a plain function with no plugin instance in scope - still gets AppKit’s retry / timeout / telemetry chain. Without a registered plugin (a direct call from a script or a test) the send still runs, just without interceptors.

Every entry point takes an optional AbortSignal so the plugin’s execute() timeout and a client disconnect both stop the caller waiting on SMTP.