Toolpal

@toolpal/email-send

public

v1.0published 1 download this weekMIT

Sends a plain-text or HTML email with optional file attachments via Resend (RESEND_API_KEY) or SMTP (SMTP_URL, supporting smtps:// and STARTTLS). Set EMAIL_FROM or pass `from` per call. Completes automated workflows alongside @toolpal/notify.

Sends plain-text or HTML emails with optional file attachments via Resend or SMTP (smtps:// port 465 or smtp:// port 587 with STARTTLS). Closes the delivery loop alongside @toolpal/notify for automated workflows.

Setup

Configure either Resend or SMTP (you only need the variables for the provider you use):

ProviderEnvironment VariablesNotes
ResendRESEND_API_KEY, EMAIL_FROMUses https://api.resend.com/emails; sender domain must be verified in Resend
SMTPSMTP_URL, EMAIL_FROMe.g. smtps://user:[email protected]:465 or smtp://user:[email protected]:587

You can also pass from per call instead of setting EMAIL_FROM.

Example

{
  "to": ["[email protected]"],
  "subject": "Weekly expense report",
  "text": "Attached is this week's expense report.",
  "files": ["expense-report.xlsx"]
}

Notes

  • Supports up to 10 MB of total file attachments per email.
  • Automatically upgrades plain smtp:// connections with STARTTLS when advertised by the server.
  • Blocks header injection (CR/LF in header fields).

Input

Validated before the workflow runs.

  • ccstring[]

    max items 50

  • torequiredstring | string[]
  • bccstring[]

    max items 50

  • fromstring

    Sender address, e.g. "Ops <[email protected]>"; defaults to EMAIL_FROM

    max length 320

  • htmlstring

    HTML email body

    max length 500000

  • textstring

    Plain-text email body

    max length 500000

  • filesfile[]

    max items 10

  • replyTostring

    min length 3 · max length 320

  • subjectrequiredstring

    min length 1 · max length 998

  • provider"auto" | "resend" | "smtp"

    Delivery backend; auto (default) uses RESEND_API_KEY if set, else SMTP_URL

JSON Schema
{
  "type": "object",
  "required": [
    "to",
    "subject"
  ],
  "properties": {
    "cc": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 320,
        "minLength": 3
      },
      "maxItems": 50
    },
    "to": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 320,
          "minLength": 3
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 320,
            "minLength": 3
          },
          "maxItems": 50,
          "minItems": 1
        }
      ]
    },
    "bcc": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 320,
        "minLength": 3
      },
      "maxItems": 50
    },
    "from": {
      "type": "string",
      "maxLength": 320,
      "description": "Sender address, e.g. \"Ops <[email protected]>\"; defaults to EMAIL_FROM"
    },
    "html": {
      "type": "string",
      "maxLength": 500000,
      "description": "HTML email body"
    },
    "text": {
      "type": "string",
      "maxLength": 500000,
      "description": "Plain-text email body"
    },
    "files": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "File attachments (10 MB total max)",
        "x-toolpal-file": true
      },
      "maxItems": 10
    },
    "replyTo": {
      "type": "string",
      "maxLength": 320,
      "minLength": 3
    },
    "subject": {
      "type": "string",
      "maxLength": 998,
      "minLength": 1
    },
    "provider": {
      "anyOf": [
        {
          "type": "string",
          "const": "auto"
        },
        {
          "type": "string",
          "const": "resend"
        },
        {
          "type": "string",
          "const": "smtp"
        }
      ],
      "description": "Delivery backend; auto (default) uses RESEND_API_KEY if set, else SMTP_URL"
    }
  }
}

Output

Validated before your agent receives it.

  • fromrequiredstring
  • providerrequired"resend" | "smtp"
  • messageIdrequiredstring
  • recipientsrequiredinteger
  • attachmentsrequiredinteger
JSON Schema
{
  "type": "object",
  "required": [
    "provider",
    "messageId",
    "from",
    "recipients",
    "attachments"
  ],
  "properties": {
    "from": {
      "type": "string"
    },
    "provider": {
      "anyOf": [
        {
          "type": "string",
          "const": "resend"
        },
        {
          "type": "string",
          "const": "smtp"
        }
      ]
    },
    "messageId": {
      "type": "string"
    },
    "recipients": {
      "type": "integer"
    },
    "attachments": {
      "type": "integer"
    }
  }
}