Setu-TS
    Preparing search index...

    Interface IMailer

    Email sender.

    const mailer = ctx.services.get<IMailer>(CAPABILITIES.MAIL);
    await mailer.send({ to: user.email, subject: 'Welcome', text: 'Welcome!' });

    0.1.0

    interface IMailer {
        isHealthy?(): Promise<boolean | undefined>;
        send(message: MailMessage): Promise<void>;
        sendTemplate(
            template: string,
            message: Omit<MailMessage, "html" | "text">,
            data: Readonly<Record<string, unknown>>,
        ): Promise<void>;
    }

    Implemented by

    Index
    • Reports whether the mail transport is REACHABLE right now, distinct from whether the mailer was constructed. Optional: a mailer whose transport exposes no side-effect-free probe omits it, and so does an implementation that does not answer the question at all.

      A false means the transport was contacted and did not answer. An undefined means the question could not be asked — never read it as healthy. This is the tri-state every reachability seam in the framework uses (IRedisClient.ping, StorageProvider.isHealthy, IMessageBroker.isHealthy), and it exists so a holder of an IMailer — notification-plugin's email channel, an application's own health indicator — can report the transport without importing mail-plugin, which AI_GUIDELINES §2.2 forbids.

      Returns Promise<boolean | undefined>

      true reachable, false contacted and unreachable, undefined when reachability cannot be determined

      0.6.0

    • Renders a named template and sends the result.

      Parameters

      • template: string

        Template name

      • message: Omit<MailMessage, "html" | "text">

        Envelope (recipients, subject overrides)

      • data: Readonly<Record<string, unknown>>

        Template variables

      Returns Promise<void>

      If the template is unknown or the provider rejects the message