@toolpal/email-send
publicv1.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):
| Provider | Environment Variables | Notes |
|---|---|---|
| Resend | RESEND_API_KEY, EMAIL_FROM | Uses https://api.resend.com/emails; sender domain must be verified in Resend |
| SMTP | SMTP_URL, EMAIL_FROM | e.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 withSTARTTLSwhen advertised by the server. - Blocks header injection (
CR/LFin 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
| Field | Type | Description |
|---|---|---|
| cc | string[] | max items 50 |
| torequired | string | string[] | - |
| bcc | string[] | max items 50 |
| from | string | Sender address, e.g. "Ops <[email protected]>"; defaults to EMAIL_FROM max length 320 |
| html | string | HTML email body max length 500000 |
| text | string | Plain-text email body max length 500000 |
| files | file[] | max items 10 |
| replyTo | string | min length 3 · max length 320 |
| subjectrequired | string | 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
| Field | Type | Description |
|---|---|---|
| fromrequired | string | - |
| providerrequired | "resend" | "smtp" | - |
| messageIdrequired | string | - |
| recipientsrequired | integer | - |
| attachmentsrequired | integer | - |
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"
}
}
}