Mailsac disposable email API via curl. Use this skill to receive test emails, validate email addresses, manage inboxes, and automate email-based QA testing.
If requests fail, run zero doctor check-connector --env-name MAILSAC_TOKEN or zero doctor check-connector --url https://mailsac.com/api/addresses/test@mailsac.com/messages --method GET
All examples below assume you have MAILSAC_TOKEN set.
Base URL: https://mailsac.com
Retrieve and read emails from any inbox.
curl -s "https://mailsac.com/api/addresses/test@mailsac.com/messages" --header "Mailsac-Key: $MAILSAC_TOKEN" | jq .
Replace <message-id> with the actual messageId from the list:
curl -s "https://mailsac.com/api/text/test@mailsac.com/<message-id>" --header "Mailsac-Key: $MAILSAC_TOKEN"
curl -s "https://mailsac.com/api/body/test@mailsac.com/<message-id>" --header "Mailsac-Key: $MAILSAC_TOKEN"
curl -s "https://mailsac.com/api/raw/test@mailsac.com/<message-id>" --header "Mailsac-Key: $MAILSAC_TOKEN"
curl -s "https://mailsac.com/api/headers/test@mailsac.com/<message-id>" --header "Mailsac-Key: $MAILSAC_TOKEN" | jq .
Message Format Endpoints:
| Endpoint | Description |
|---|---|
/api/text/{email}/{messageId} |
Plain text body |
/api/body/{email}/{messageId} |
Sanitized HTML body |
/api/dirty/{email}/{messageId} |
Unsanitized HTML with inlined images |
/api/raw/{email}/{messageId} |
Complete SMTP message |
/api/headers/{email}/{messageId} |
JSON headers |
Delete single messages or purge entire inboxes.
curl -s -X DELETE "https://mailsac.com/api/addresses/test@mailsac.com/messages/<message-id>" --header "Mailsac-Key: $MAILSAC_TOKEN"
curl -s -X DELETE "https://mailsac.com/api/addresses/test@mailsac.com/messages" --header "Mailsac-Key: $MAILSAC_TOKEN"
Note: Starred messages will NOT be purged. Unstar them first if you want to delete everything.
curl -s -X PUT "https://mailsac.com/api/domains/yourdomain.com/delete-all-domain-mail" --header "Mailsac-Key: $MAILSAC_TOKEN"
Manage private email addresses for exclusive use.
curl -s -X POST "https://mailsac.com/api/addresses/mytest@mailsac.com" --header "Mailsac-Key: $MAILSAC_TOKEN" | jq .
Response:
{
"_id": "mytest@mailsac.com",
"owner": "your-username",
"forward": null,
"webhook": null,
"webhookSlack": null,
"enablews": false,
"created": "2024-01-01T00:00:00.000Z",
"updated": "2024-01-01T00:00:00.000Z"
}
curl -s "https://mailsac.com/api/addresses" --header "Mailsac-Key: $MAILSAC_TOKEN" | jq .
curl -s -X DELETE "https://mailsac.com/api/addresses/mytest@mailsac.com" --header "Mailsac-Key: $MAILSAC_TOKEN"
curl -s -X DELETE "https://mailsac.com/api/addresses/mytest@mailsac.com?deleteAddressMessages=true" --header "Mailsac-Key: $MAILSAC_TOKEN"
Configure webhooks to receive email notifications in real-time.
Write to /tmp/mailsac_webhook.json:
{
"webhook": "https://your-server.com/email-webhook"
}
Then run:
curl -s -X PUT "https://mailsac.com/api/private-address-forwarding/mytest@mailsac.com" --header "Mailsac-Key: $MAILSAC_TOKEN" --header "Content-Type: application/json" -d @/tmp/mailsac_webhook.json | jq .
Write to /tmp/mailsac_webhook.json:
{
"webhook": ""
}
Then run:
curl -s -X PUT "https://mailsac.com/api/private-address-forwarding/mytest@mailsac.com" --header "Mailsac-Key: $MAILSAC_TOKEN" --header "Content-Type: application/json" -d @/tmp/mailsac_webhook.json | jq .
Webhook Payload Format:
{
"text": "Email body content",
"subject": "Email subject",
"from": [{"address": "sender@example.com", "name": "Sender Name"}],
"to": [{"address": "recipient@mailsac.com", "name": ""}],
"headers": {},
"messageId": "unique-message-id",
"date": "2024-01-01T00:00:00.000Z",
"receivedDate": "2024-01-01T00:00:00.000Z",
"raw": "Full RFC-formatted email"
}
Validate email addresses and detect disposable email services.
curl -s "https://mailsac.com/api/validations/addresses/test@example.com" --header "Mailsac-Key: $MAILSAC_TOKEN" | jq .
Response:
{
"email": "test@example.com",
"isValidFormat": true,
"isDisposable": false,
"disposableDomains": [],
"aliases": [],
"domain": "example.com",
"local": "test"
}
curl -s "https://mailsac.com/api/validations/addresses/test@mailsac.com" --header "Mailsac-Key: $MAILSAC_TOKEN" | jq '{email, isDisposable}'
Validation Response Fields:
| Field | Description |
|---|---|
isValidFormat |
Email syntax is valid |
isDisposable |
Email is from a disposable service |
disposableDomains |
List of identified disposable domains |
aliases |
Domain aliases and IP addresses |
domain |
Domain part of email |
local |
Local part of email |
Send emails via API (requires outgoing message credits).
Write to /tmp/mailsac_outgoing.json:
{
"to": "recipient@example.com",
"from": "sender@mailsac.com",
"subject": "Test Email",
"text": "This is the email body content."
}
Then run:
curl -s -X POST "https://mailsac.com/api/outgoing-messages" --header "Mailsac-Key: $MAILSAC_TOKEN" --header "Content-Type: application/json" -d @/tmp/mailsac_outgoing.json | jq .
Note: Sending requires purchased credits unless sending within your custom domain.
Download attachments from received emails.
curl -s "https://mailsac.com/api/addresses/test@mailsac.com/messages/<message-id>/attachments/<attachment-md5>" --header "Mailsac-Key: $MAILSAC_TOKEN" > attachment.bin
curl -s "https://mailsac.com/api/raw/test@mailsac.com/<message-id>" --header "Mailsac-Key: $MAILSAC_TOKEN" > message.eml
Note: For public addresses, attachments must be downloaded via API; they are not viewable on the website.
Prevent messages from being auto-deleted by starring them.
curl -s -X PUT "https://mailsac.com/api/addresses/test@mailsac.com/messages/<message-id>/star" --header "Mailsac-Key: $MAILSAC_TOKEN" | jq .
EMAIL="test-$(date +%s)@mailsac.com"
echo "Use this email for registration: $EMAIL"
# Poll for new message (check every 5 seconds, max 60 seconds)
for i in $(seq 1 12); do
MESSAGES=$(curl -s "https://mailsac.com/api/addresses/$EMAIL/messages" --header "Mailsac-Key: $MAILSAC_TOKEN")
COUNT=$(echo "$MESSAGES" | jq 'length')
if [ "$COUNT" -gt "0" ]; then
MESSAGE_ID=$(echo "$MESSAGES" | jq -r '.[0]._id')
echo "Message received: $MESSAGE_ID"
curl -s "https://mailsac.com/api/text/$EMAIL/$MESSAGE_ID" --header "Mailsac-Key: $MAILSAC_TOKEN"
break
fi
echo "Waiting for email... ($i/12)"
sleep 5
done
curl -s "https://mailsac.com/api/addresses/test@mailsac.com/messages" --header "Mailsac-Key: $MAILSAC_TOKEN" | jq '.[] | {subject, from: .from[0].address, received: .received}'
curl -s -X DELETE "https://mailsac.com/api/addresses/test@mailsac.com/messages" --header "Mailsac-Key: $MAILSAC_TOKEN"
echo "Inbox purged"
curl -s "https://mailsac.com/api/validations/addresses/user@tempmail.com" --header "Mailsac-Key: $MAILSAC_TOKEN" | jq 'if .isDisposable then "DISPOSABLE" else "LEGITIMATE" end'
[
{
"_id": "message-id-here",
"from": [{"address": "sender@example.com", "name": "Sender"}],
"to": [{"address": "test@mailsac.com", "name": ""}],
"subject": "Email Subject",
"received": "2024-01-01T00:00:00.000Z",
"size": 1234,
"attachments": []
}
]
{
"email": "test@mailsac.com",
"isValidFormat": true,
"isDisposable": true,
"disposableDomains": ["mailsac.com"],
"aliases": ["104.197.186.12"],
"domain": "mailsac.com",
"local": "test"
}
| Type | Limit |
|---|---|
| Public address message retention | 4 days |
| Public inbox max messages | 6 |
| Max message size | 2.5 MB |
| Operations quota reset | 1st of each month (UTC) |