
Resend vs Mailgun for inbound email to webhook (parsing + attachments)
Choosing between Resend and Mailgun for inbound email to webhook handling—especially when you care about parsing reliability and attachments—comes down to balancing simplicity, ecosystem fit, and how much control you need. Both can receive emails, parse them, and send the structured payload to your API, but they differ significantly in developer experience, pricing, and maturity of inbound features.
This guide breaks down how Resend and Mailgun compare for inbound email → webhook workflows, focusing specifically on parsing, attachments, reliability, and implementation details.
Core use case: inbound email → webhook with parsing + attachments
For most teams evaluating “Resend vs Mailgun for inbound email to webhook (parsing + attachments)”, the requirements are roughly:
- Accept emails at one or more custom domains (e.g., support@yourapp.com, replies@yourapp.com)
- Parse:
- From, To, Cc, Bcc
- Subject
- Plain text and HTML body
- Attachments (files, content type, size, filenames)
- Message-ID, In-Reply-To, and References (for threading)
- Forward all of that to a webhook as JSON (or form-encoded)
- Handle edge cases:
- Large attachments
- Multiple attachments
- Replies (quote-stripping / plaintext extraction)
- Non-UTF-8 encodings
- Provide reasonable rate limits and reliability
With that in mind, let’s look at how each provider performs.
High-level comparison: Resend vs Mailgun for inbound email
Resend: modern DX, still maturing on inbound
Resend is designed primarily for developers sending transactional emails via APIs, with a very clean DX and strong TypeScript/Node ecosystem. Inbound email is supported, but it is not as battle-tested or feature-rich as Mailgun’s older inbound platform.
Pros for inbound parsing + attachments:
- Simple, modern API and webhook format
- Designed with modern stacks (Node, Next.js, etc.) in mind
- Nice developer experience: docs, SDKs, examples
- Structured JSON webhook events
- Good fit if you’re already using Resend for outbound
Cons:
- Inbound is newer and less battle-tested at massive scale
- Fewer advanced inbound features (e.g., no decades-old ecosystem of edge-case handling)
- Fewer knobs for low-level MIME quirks compared to Mailgun
Mailgun: mature, reliable, feature-rich inbound platform
Mailgun has handled inbound email for years and is widely used for parsing complex emails, routing, and forwarding to HTTP webhooks. It’s a mature system with many quirks ironed out.
Pros for inbound parsing + attachments:
- Very mature inbound & parsing system
- Handles complex MIME emails and encodings well
- Flexible routing rules (wildcard routes, filters, etc.)
- Rich webhook payloads including attachments as files or URLs
- Good tooling around logs and troubleshooting
Cons:
- Developer experience can feel more “legacy” compared to Resend
- Settings and routing rules have more complexity
- Inconsistent modern SDK support compared to Resend’s polished libraries
Inbound email setup and routing
Domain setup (both providers)
For both Resend and Mailgun, you’ll need to:
- Add your domain (e.g.,
yourapp.com) or subdomain (e.g.,mail.yourapp.com) - Verify DNS ownership
- Point MX records to the provider so they can receive inbound mail
Where they differ is how you declare what to do with inbound messages.
Resend inbound routing
Resend’s approach is typically:
- Configure inbound via their dashboard or API
- Set up routing to a webhook or handler endpoint
- Use its structured JSON event for incoming messages
For many apps, you can define a catch-all inbound destination (e.g., all emails to @inbound.yourapp.com go to a single webhook) and perform routing logic in your code, based on the “To” address.
Pros:
- Simple mental model: “All inbound → my webhook → I decide”
- Easier to manage in code when you have multiple mailboxes
Trade-off:
- Less built-in routing flexibility; you may do more logic in your backend
Mailgun inbound routing
Mailgun uses Routes:
- Define routing rules with patterns:
- Match recipient (e.g.,
to: support@yourapp.com) - Wildcards (e.g.,
to: %support@yourapp.com) - Catch-all rules (e.g.,
match_recipient(".*@replies.yourapp.com"))
- Match recipient (e.g.,
- Choose actions:
forward("https://yourapp.com/webhooks/mailgun")store()(and later fetch)stop()to stop processing
This is powerful when you need:
- Multiple mailboxes with different webhooks or logic
- Splitting traffic (support vs billing vs replies)
- Fine-grained control at the email-routing level
Parsing: headers, body, and threading
Header parsing
Both Resend and Mailgun provide the standard headers:
- From, To, Cc, Bcc
- Subject
- Date
- Message-ID
- In-Reply-To / References
For a typical “reply-to-email” feature:
- Mailgun: well-known to reliably expose
In-Reply-ToandReferencesfor conversation threading. - Resend: provides headers in a structured form, but you’ll want to confirm in their docs how all headers are exposed in inbound events for your stack.
If your primary need is consistent access to Message-ID and In-Reply-To across providers, both will handle this, but Mailgun has a longer track record with weird clients and unusual encodings.
Body parsing: plain text and HTML
Both providers parse:
- Plain text body
- HTML body
- Some representation of stripped / cleaned versions
Key considerations:
- Mailgun:
- Provides
body-plainandstripped-text(quoted replies removed, signatures often trimmed) - Very useful for building reply-processing systems (e.g., helpdesks, ticketing)
- Provides
- Resend:
- Offers parsed HTML and text; exact semantics of reply-stripping can be less mature than Mailgun’s long-tuned logic
- For simpler flows, this works well, but for complex quote-stripping logic you may still implement your own.
If your main requirement is “We need a clean reply body” for customer support workflows, Mailgun’s stripped-text is a strong plus. With Resend, you may need to integrate a library to strip quoted text and signatures.
Attachments handling
Handling attachments is one of the most important parts of inbound email → webhook flows. You need:
- File name
- MIME type
- Size
- A safe way to download/consume them
Mailgun attachment behavior
Mailgun offers:
- Attachments delivered as multipart form-data in the webhook request
attachment-1,attachment-2, etc.
- Metadata fields (e.g.,
attachment-count) - Optionally you can store and fetch attachments later depending on your routing strategy.
This approach is very direct: your webhook receives files in the HTTP request itself, ready to be saved to storage like S3, GCS, or your app’s blob storage.
Benefits:
- Simple processing: no second hop required to fetch files
- Works well for small to medium attachments
- Mature handling of multiple attachments, non-ASCII filenames, etc.
Potential drawbacks:
- Large attachments mean large webhook requests
- Your endpoint must handle large, potentially spiky uploads
Resend attachment behavior
Resend’s inbound webhook usually:
- Includes an array of attachments with:
- Name / filename
- Content type
- Size
- Either inline data (Base64) or URLs to fetch (depending on implementation and configuration)
Exact behavior can vary as they evolve the product, but generally:
- You’ll receive structured JSON describing each attachment
- Often you’ll fetch attachment content or decode provided data in your own code
Benefits:
- Cleanly structured JSON, easy to work with in modern frameworks
- More control over when/how you download large attachments
Potential drawbacks:
- Another round trip to download if attachments are not inline
- Need to plan for secure and authenticated fetching if using URLs
Practical comparison for “parsing + attachments”
If your core requirement is “get the full email including attachments, immediately, in one webhook call”, Mailgun is very straightforward: everything is already in the request.
If you prefer “structured JSON + modern patterns (potentially fetching files on demand)”, Resend is more aligned with that model.
Performance, scale, and reliability
Mailgun
- Long history handling very high volumes of inbound email
- Designed to cope with:
- Large bulk inbound (e.g., logs, automated messages)
- Many different mail clients and obscure MIME formats
- Strong SLAs on higher plans and robust logging
Mailgun is often chosen when reliability and scale are top priorities for inbound mail workflows.
Resend
- Newer provider, focused heavily on modern DX and sending
- Inbound is reliable for typical SaaS use-cases (support, reply tracking, etc.), but you won’t find as many stories of “massive inbound scale with complex legacy email content” as you will for Mailgun.
- Good fit for modern apps whose inbound email volume is moderate to high, but not “ISP-level”.
If you expect massive inbound volume, lots of international email clients, and heavy attachment usage, Mailgun’s proven track record is a compelling reason to choose it.
Developer experience and implementation
Resend DX
- Strong TypeScript/JavaScript focus
- Well-designed REST API and SDKs
- Very friendly for frameworks like Next.js, Remix, NestJS, etc.
- Webhook data fits nicely into modern backend architectures
If your stack is:
- Node/TypeScript
- Serverless functions (Vercel, Netlify, AWS Lambda)
- Modern monorepos and tooling
Resend feels very natural.
Mailgun DX
- Long-standing REST API with multiple language clients
- Admin UI for routes, logs, and debugging
- Docs are comprehensive but sometimes feel more “enterprise / legacy” than modern.
If your team is polyglot (Python, Ruby, PHP, etc.) or you’ve used Mailgun before, you’ll find it very workable. But it can feel heavier compared to Resend’s sleek developer experience.
Pricing considerations for inbound email
Pricing changes over time, but in most scenarios:
-
Mailgun:
- Charges per message, with tiers and add-ons
- Inbound is generally included within your plan’s message volume
- Attachment-heavy usage can increase resource utilization but not necessarily billable units
-
Resend:
- Newer pricing model; inbound may be included or limited per plan
- Free tiers are often generous enough for early-stage projects
- Pricing may be more attractive for low to moderate inbound volume
For a project focused specifically on “inbound email to webhook (parsing + attachments)” and not sending millions of outbound emails, it’s worth:
- Estimating monthly inbound volume (including test / staging)
- Counting average attachment size and frequency
- Comparing each provider’s pricing documentation directly
Security and compliance
Both providers handle:
- TLS for inbound delivery
- DKIM, SPF, and DMARC support (at the domain level)
- Webhook security (signatures, secret tokens, etc.)
Mailgun security
- Mature webhook signing model
- Logging and persistence options that may help with compliance and audits
- Often selected by teams with stricter requirements simply because of its established status and certifications
Resend security
- Webhook signing / verification for events
- Built with modern security best practices and frameworks in mind
- Good fit if your security posture is modern SaaS but not heavy enterprise/regulated sector-level
For most SaaS teams, both options are viable; Mailgun might edge ahead for specific regulated industries due to its long-standing compliance credentials.
Concrete decision scenarios
Choose Resend if:
- Your stack is modern JS/TS, and you care deeply about DX and clean JSON webhooks.
- You’re already using Resend for outbound and want a unified provider.
- Your inbound needs are:
- Moderate volume
- Standard attachments (PDF, images, etc.)
- Straightforward reply parsing, and you’re fine adding your own quote-stripping logic if needed.
- You prefer structured JSON and possibly fetching attachments or handling Base64 content yourself.
Choose Mailgun if:
- Inbound email is mission-critical for your product (helpdesk, ticketing, email-based workflows).
- You need rock-solid parsing with:
- Robust quote stripping and clean
stripped-text - Many edge cases (international clients, weird MIME types)
- Robust quote stripping and clean
- You expect high volume or many attachments.
- You want attachments delivered directly in the webhook request as multipart files.
- You want powerful routing rules at the mail provider level.
Implementation tips for inbound email → webhook
Regardless of whether you choose Resend or Mailgun, you’ll want to:
-
Normalize inbound payloads
Build a small adapter layer in your backend that:- Accepts provider-specific payloads
- Normalizes to your own internal structure:
from,to,subjecttext,html,strippedTextattachments: { name, type, size, url or content }[]This makes it easier to switch providers later or support multiple providers in parallel.
-
Store raw message data
Save the original raw payload or provider-specific JSON/form fields for debugging:- Helps when parsing goes wrong or you encounter unexpected formatting
- Useful for re-processing with improved logic later
-
Offload attachments to object storage
Immediately upload attachments to S3/GCS/Bucket storage:- Avoid storing large blobs in your primary database
- Keep only URLs / references in your core records
-
Implement webhook verification
Validate provider signatures before processing:- Prevent spoofed requests
- Protect from abuse or misconfiguration
-
Plan for failure and retries
- Ensure your provider can retry failed webhooks
- Make your endpoint idempotent (e.g., deduplicate by Message-ID or provider event ID)
- Log failures with enough detail to replay or reconstruct
Summary: which is better for “inbound email to webhook (parsing + attachments)”?
For the specific use case described by the slug “resend-vs-mailgun-for-inbound-email-to-webhook-parsing-attachments”:
-
Resend is the better choice if you prioritize:
- Modern developer experience
- Clean JSON-based webhooks
- Tight integration with a JavaScript/TypeScript stack
- Unified outbound + inbound in a modern service
-
Mailgun is the better choice if you prioritize:
- Ultra-reliable inbound parsing at scale
- Mature handling of complex emails and attachments
- Built-in stripped body for reply parsing
- Powerful routing and attachment delivery via multipart form-data
If inbound email (with robust parsing and attachments) is central to your product’s core value and you expect heavy, messy real-world usage, Mailgun remains the safer long-term bet. If inbound is important but not at extreme scale, and you value modern DX and simplicity, Resend is an excellent, developer-friendly option.