Sending email
Validate, send, and track transactional email from your agent or app with the Mailly API, with delivery events for the final status.
Send from a claimed inbox address or an address on a domain verified for sending. Authenticate with Authorization: Bearer $MAILLY_API_KEY.
curl https://api.mailly.site/send-email \
-H "Authorization: Bearer $MAILLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fromEmail": "your-inbox@mailly.site",
"to": "you@example.com",
"subject": "Hello from my agent",
"text": "Your first email is ready.",
"dryRun": true
}'dryRun validates parameters without sending or charging usage. When the request looks right:
- Check your usage balance or included email count.
- Remove
dryRunand send. - Review the result in Sent. An accepted request is not proof of delivery; final status arrives as delivery events.
Do not automatically retry a direct-send request whose outcome is unknown. Check Sent first, or you may deliver the same email twice.
Multi-recipient sends and campaigns are queued and return a task ID; poll it with Get batch task status.
Other ways to send
- SMTP for existing mail libraries.
mailly sendin the CLI.mailly_send_emailover Remote MCP, always validated withdry_runfirst.
Attachments and inline images
A direct send to one recipient, a reply or a forward can carry up to 10 files, 6 MB in total. A file with a content ID is sent as an inline image: reference it in the HTML body as <img src="cid:logo">. Campaigns accept inline images only (up to 10, 1 MB in total).
- API: pass
attachments: [{ filename, mimeType, contentBase64, contentId? }]. - CLI:
--attachment ./report.pdfand--inline logo=./logo.png. - MCP: each item in
attachmentstakes either a publicurl, which Mailly downloads when sending, or a smallcontent_base64, plus an optionalcontent_id.
See the Send email reference for every field.