API Endpoints
Basic Operations
GETList MessagesGETGet Message MetadataGETGet HTML ContentGETGet Plain TextGETGet Message SourceGETDownload as EMLREST API
Complete API reference for MailCatcher NG. All endpoints are local only and require no authentication.
Basic Operations
/messagesReturns JSON array of all messages with basic metadata.
curl http://127.0.0.1:1080/messagesResponse
[
{
"id": 1,
"from": ["sender@example.com"],
"to": ["recipient@example.com"],
"subject": "Test Email",
"created_at": "2024-01-10T10:30:00Z"
}
]/messages/:id.jsonReturns detailed metadata for a specific message including headers, sender, recipients, and body info.
curl http://127.0.0.1:1080/messages/1.json/messages/:id.htmlReturns the HTML version of the message rendered in the browser.
curl http://127.0.0.1:1080/messages/1.html/messages/:id.plainReturns the plain text version of the message.
curl http://127.0.0.1:1080/messages/1.plain/messages/:id.sourceReturns the complete raw email source in MIME format.
curl http://127.0.0.1:1080/messages/1.source/messages/:id.emlDownloads the message as an EML file (RFC 822), suitable for importing into email clients.
curl -O http://127.0.0.1:1080/messages/1.emlAdvanced Operations
/messages/:id/transcript.jsonReturns the SMTP transcript including all commands, responses, and TLS details for debugging connection issues.
curl http://127.0.0.1:1080/messages/1/transcript.jsonIncludes
- • Session ID and client/server connection details
- • TLS protocol version and cipher suite
- • Complete SMTP command/response transcript
- • Connection timing information
/messages/:id.transcriptReturns SMTP transcript rendered as an HTML page for viewing in a browser.
curl http://127.0.0.1:1080/messages/1.transcript/messages/:id/parts/:cidDownloads a specific message part or attachment by its Content-ID.
# First, get the message metadata to find attachment CIDs
curl http://127.0.0.1:1080/messages/1.json | jq '.parts'
# Then download the attachment
curl -O http://127.0.0.1:1080/messages/1/parts/image-001/messages/searchSearch messages across subject, sender, recipient, and body content with optional filtering.
Query Parameters
q - Search query (required)
has_attachments - Filter by attachments (true/false)
from - Start date (ISO 8601)
to - End date (ISO 8601)
curl "http://127.0.0.1:1080/messages/search?q=verification&has_attachments=false"
curl "http://127.0.0.1:1080/messages/search?q=noreply@example.com&from=2024-01-01&to=2024-01-31"/messages/:id/extractExtracts verification tokens, magic links, OTP codes, or reset tokens from message content.
Query Parameters
type - Type to extract: token, link, or otp
# Extract OTP code
curl "http://127.0.0.1:1080/messages/1/extract?type=otp"
# Extract magic link
curl "http://127.0.0.1:1080/messages/1/extract?type=link"
# Extract reset token
curl "http://127.0.0.1:1080/messages/1/extract?type=token"/messages/:id/links.jsonReturns all links found in the message with metadata about their purpose (verification, unsubscribe, etc).
curl http://127.0.0.1:1080/messages/1/links.json/messages/:id/parsed.jsonReturns comprehensive structured data parsed from the message including verification URLs, OTP codes, reset tokens, and all links.
curl http://127.0.0.1:1080/messages/1/parsed.json/messages/:id/accessibility.jsonAnalyzes HTML email for accessibility issues and returns a score (0-100) with recommendations.
Score Breakdown
- •
images_with_alt- Percentage of images with alt text - •
semantic_html- Use of semantic HTML tags - •
score- Overall accessibility score (0-100)
curl http://127.0.0.1:1080/messages/1/accessibility.jsonManagement
/messages/:id/forwardForwards the caught email to its original recipient(s) using a configured SMTP server. Useful for final validation after testing.
Note: Requires MailCatcher to be started with SMTP forwarding configuration.
# Start MailCatcher with forwarding enabled
mailcatcher \
--forward-smtp-host smtp.example.com \
--forward-smtp-port 587 \
--forward-smtp-user your-username@example.com \
--forward-smtp-password your-password
# Then forward a message
curl -X POST http://127.0.0.1:1080/messages/1/forward/messages/:idDeletes a specific message from storage.
curl -X DELETE http://127.0.0.1:1080/messages/1/messagesClears all stored messages.
curl -X DELETE http://127.0.0.1:1080/messagesSystem
/server-infoReturns server configuration and status information.
Response Includes
- • MailCatcher version
- • HTTP and SMTP server ports
- • Hostname and IP addresses
- • Connection counts and statistics
curl http://127.0.0.1:1080/server-info/messages (WebSocket)Upgrades the HTTP connection to WebSocket for receiving real-time notifications about new messages, deletions, and clears.
Message Types
- •
add- New message arrived - •
remove- Message was deleted - •
clear- All messages cleared
const ws = new WebSocket('ws://127.0.0.1:1080/messages');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'add') {
console.log('New message:', data.message);
} else if (data.type === 'remove') {
console.log('Message deleted:', data.id);
}
};/Terminates the MailCatcher server instance.
⚠️ Warning: This will shut down the server. Use the --no-quit flag to disable this endpoint.
curl -X DELETE http://127.0.0.1:1080/