Receive file attachments via email
Extract, store, and process email attachments automatically. Get structured metadata and download URLs.
The Problem
- Parsing MIME attachments from raw email is complex and error-prone
- Attachment encoding varies across email clients and breaks your parser
- Storing attachments requires setting up file storage infrastructure
- Large attachments can timeout your email processing pipeline
- Inline images and regular attachments are mixed together confusingly
Why Existing Solutions Fall Short
MIME parsing libraries require deep knowledge of email internals
Base64 decoding and content-type detection is tedious to implement
Self-hosted storage adds infrastructure burden and security concerns
Email forwarding strips or corrupts attachments unpredictably
You shouldn't have to build this yourself.
How Mailhooks Solves This
Automatic Extraction
Attachments are extracted and stored automatically. No parsing required.
Secure Storage
Files are stored securely and delivered via signed download URLs.
Rich Metadata
Get filename, content type, size, and checksum for every attachment.
Inline vs Attached
Clearly distinguish between inline images and file attachments.
How It Works
Email with files
User sends an email with attachments to your inbox.
Auto extraction
Mailhooks parses and stores all attachments.
Webhook fires
Your endpoint receives metadata and download URLs.
Download files
Fetch attachments using the signed URLs.
Process
Handle files in your application as needed.
Code Example
Attachments are extracted and delivered with secure download URLs.
Webhook Payload
{
"id": "msg_attach789",
"from": "user@example.com",
"to": "uploads@inbox.mailhooks.dev",
"subject": "Documents for review",
"text": "Please see attached files.",
"attachments": [
{
"filename": "report.pdf",
"contentType": "application/pdf",
"size": 245678,
"checksum": "sha256:abc123...",
"url": "https://files.mailhooks.dev/...",
"inline": false
},
{
"filename": "chart.png",
"contentType": "image/png",
"size": 45678,
"checksum": "sha256:def456...",
"url": "https://files.mailhooks.dev/...",
"inline": true,
"contentId": "chart-001"
}
]
}Handler Code
// Process email attachments
app.post('/webhooks/email', async (req, res) => {
const { from, subject, attachments } = req.body;
for (const attachment of attachments) {
// Skip inline images if needed
if (attachment.inline) continue;
console.log(`Processing: ${attachment.filename}`);
console.log(`Size: ${attachment.size} bytes`);
console.log(`Type: ${attachment.contentType}`);
// Download the attachment
const response = await fetch(attachment.url);
const buffer = await response.arrayBuffer();
// Save to your storage, process, etc.
await saveToS3(attachment.filename, buffer);
}
res.status(200).send('OK');
});Get Started in 3 Steps
Takes ~2 minutes — no email infrastructure required.
Create a Mailhooks account
Sign up for free in seconds.
Create an inbox
Get a unique email address for your use case.
Add your webhook URL
Point to your endpoint and start receiving emails.
Related use cases
Reply-by-Email for SaaS Applications
Let users respond to notifications directly from their inbox. Receive email replies as webhook payloads in your SaaS app — no email infrastructure required.
Push Notifications
Trigger n8n Workflows from Email
Use Mailhooks as the email trigger for your n8n automations. Instant webhook delivery, attachment handling, and AI-ready payloads — no IMAP node or polling required.