Skip to content

Function: getEmailRuntime()

getEmailRuntime(overrides?): EmailRuntime

Return the shared runtime, building it on first use by resolving overrides over the environment (SMTP_HOST, SMTP_PORT, SMTP_SECURE, SMTP_USER, SMTP_PASSWORD, EMAIL_DOMAIN, EMAIL_FROM, EMAIL_ALLOWED_SENDERS, EMAIL_SENDER_POLICY, EMAIL_OUTBOX_MODE, EMAIL_OUTBOX_DIR) through resolveEmailConfig. With SMTP credentials present it holds a nodemailer transport and its connection pool; otherwise it is in file/outbox mode and holds none.

overrides is read only on the call that builds the runtime, so prime it from the plugin’s config at setup; later callers (the tool’s execute, the sender-options route) pass nothing and get the same instance. Throws whatever resolveEmailConfig throws for an unusable configuration.

EmailPluginConfig

EmailRuntime