# @toolpal/email-send 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:pass@smtp.gmail.com:465` or `smtp://user:pass@smtp.example.com:587` | You can also pass `from` per call instead of setting `EMAIL_FROM`. ## Example ```json { "to": ["alice@example.com"], "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).