Skip to content

EmailNotifier ​

Built-in outbound e-mail driver, backed by MailKit for full SMTP support: STARTTLS, implicit-SSL, plain transports, and SASL authentication. Pair with the AI runtime to mail AI-generated run reports, or hook script lifecycle events to send "long run finished" alerts.

For the broader picture see the Notifications guide.

Properties ​

PropertyTypeAccessDescription
hoststringRSMTP host
portintRSMTP port
fromstringRDefault From address
securitystringRTransport security (starttls | ssl | none | auto)
sendCountintRTotal successful sends
failCountintRTotal failed sends
lastErrorstringRError message of the most recent failed send
lastSentAtstringRISO-8601 timestamp of the most recent successful send

Actions ​

ActionArgsDescription
send{ to, subject, body, html?, cc?, bcc?, from?, attachments? }Send one e-mail

to, cc, and bcc accept either a single address or a comma-separated list.

When both body (plain) and html are provided, the message is sent as multipart/alternative so clients that don't render HTML still see the plain version.

attachments is an array of absolute file paths readable by the server process. Each is embedded inline into the MIME message — keep individual attachments under a few MB.

Streams ​

StreamDescription
deliveryPer-send outcome: { outcome, to, subject, error, timestamp }

Config Options ​

OptionTypeDefaultDescription
hoststring—SMTP host (required)
portint587SMTP port (587 STARTTLS, 465 SSL, 25 plain)
securitystring"starttls"starttls | ssl | none | auto
usernamestring—Auth username (omit for unauthenticated relay)
passwordstring—Auth password
fromstring—Default From address (overrideable per-send)
timeoutMsint15000Connect/send timeout

Common SMTP Settings ​

Providerhostportsecurity
Gmail (App Password)smtp.gmail.com587starttls
Microsoft 365 / Outlooksmtp.office365.com587starttls
Local relay (no auth)127.0.0.125none

For Gmail, generate an App Password (Google Account → Security → 2-Step Verification → App passwords) and use that as the password.

Safety ​

The driver opts into the safety gate (RequiresSafetyGates = true). The first send() to a new recipient triggers a confirmation prompt in the UI; subsequent sends to the same address pass through.

Credentials live in the workspace — keep email.js connector files out of any shared repo.

Example ​

Minimal ​

javascript
// workspace/connectors/email.js
export default {
  driver: "EmailNotifier",
  config: {
    host:     "smtp.gmail.com",
    port:     587,
    security: "starttls",
    username: "alerts@example.com",
    password: "abcd-efgh-ijkl-mnop",
    from:     "Muxit Lab <alerts@example.com>",
  },
};

AI-generated run report ​

javascript
const summary = ai(
  `Summarise this measurement run for a lab colleague.
   Highlight anomalies and suggest a follow-up step.
   Samples: ${samples.join(", ")}`
);

connector("email").send({
  to: "lab@example.com",
  subject: `Run report — ${samples.length} samples`,
  body: summary,
});

With attachment ​

javascript
connector("email").send({
  to: "lab@example.com",
  subject: "Daily CSV export",
  body: "See attached for today's measurements.",
  attachments: ["C:/muxit/workspace/runs/2026-04-30.csv"],
});

HTML alternative ​

javascript
connector("email").send({
  to: "lab@example.com",
  subject: "Threshold breach",
  body: "Sensor temp 81.2 °C — above 80 °C threshold.",
  html: "<p>Sensor temp <b>81.2 °C</b> — above 80 °C threshold.</p>",
});

Muxit — Hardware Orchestration Platform