This is useful for delivering invoices, reports, receipts, or any other documents generated by your application.
Prerequisites
- A thePurplebox account
- A secret API key generated from your dashboard
- A verified sending domain (recommended for best deliverability)
Parameters
When sending an email with attachments, include the following in your request:- to — A single email address or array of recipient emails
- subject — The email subject line
- body — Plain text or HTML content for the email body
- attachments — An array of attachment objects (up to 5 files):
- filename — The name of the file as it will appear to the recipient
- content — Base64-encoded file data
- contentType — MIME type (e.g.,
application/pdf,image/png)
Important Notes
- You can attach up to 5 files per email
- The
contentfield must be base64 encoded - Maximum attachment size per file is 5MB
- Total email size (including all attachments) must not exceed 25MB
Example Requests
- JavaScript
- Go
- Python
- PHP
- Java
- Ruby
- C#
- ASP.NET
- cURL