# Receive email in your application with webhooks

Receive email in your application with inbox webhooks, typed event payloads, attachment APIs, delivery history, retries, and replay-safe processing.

Create a real inbox, attach an HTTP endpoint, and let MailSlurp post a typed event when email arrives. Store the event and message IDs, fetch the full body or attachments by API, and keep delivery history available for retries and investigation.

[Start free](https://app.mailslurp.com/sign-up/?onboardingRequest=messaging) [View webhook docs](https://www.mailslurp.com/docs/webhooks/)

![Create an inbox webhook in the MailSlurp dashboard](https://assets-cdn.mailslurp.com/image-variants/1024/assets/app/create-webhook.png?v=ee81cd916bc54cf97efef2a86cc63dc6185c6d7b)

Trusted by top companies worldwide

- ![Broadcom](https://www.mailslurp.com/assets/companies/broadcom.svg)
- ![Scraper](https://www.mailslurp.com/assets/companies/scraper.svg)
- ![Trivago](https://www.mailslurp.com/assets/companies/trivago.svg)
- ![Avast](https://www.mailslurp.com/assets/companies/avast.svg)
- ![Wolt](https://assets-cdn.mailslurp.com/image-variants/340/assets/companies/wolt.png?v=ee81cd916bc54cf97efef2a86cc63dc6185c6d7b)
- ![Panasonic](https://www.mailslurp.com/assets/companies/panasonic.svg)

## Attach event delivery to the inbox that owns the workflow

Use a dedicated inbox for support, invoices, orders, replies, or application mail. Register the callback once, choose the event types the consumer needs, and keep mailbox ownership separate across customers and environments.

[Configure email webhooks](https://www.mailslurp.com/docs/webhooks/)

![Create an inbox webhook in the MailSlurp dashboard](https://assets-cdn.mailslurp.com/image-variants/1024/assets/app/create-webhook.png?v=ee81cd916bc54cf97efef2a86cc63dc6185c6d7b)

![MailSlurp webhook delivery history with event outcomes](https://assets-cdn.mailslurp.com/image-variants/1512/assets/app/webhook-history.png?v=ee81cd916bc54cf97efef2a86cc63dc6185c6d7b)

## Acknowledge quickly, then process and replay safely

Persist the event ID and message ID before downstream work begins. A worker can retrieve the full message, inspect headers and attachments, run extraction, and retry without asking the sender to resend the email.

[Plan the inbound pipeline](https://www.mailslurp.com/inbound-email-api/)

## Handle inbound email events in TypeScript

Validate the incoming event, acknowledge it promptly, and move parsing or business actions into a retry-safe worker. Fetch the complete email record by API when the handler needs message bodies, headers, links, or attachments.

[View API reference](https://www.mailslurp.com/docs/api/)

Inbound email webhook server

```typescript
import express from "express";
import type { WebhookNewEmailPayload } from "mailslurp-client";

const app = express();
app.use(express.json());

app.post("/webhooks/mailslurp", async (request, response) => {
  const payload = request.body as WebhookNewEmailPayload;

  // Store the idempotent message ID before acknowledging the event.
  await saveWebhookEventOnce(payload.messageId, payload);
  response.sendStatus(204);

  // Fetch the full email and attachments in a retry-safe worker.
  void queueInboundEmail(payload.emailId).catch(console.error);
});
```

## A reliable email-to-webhook contract

Keep the first request small and make the stored MailSlurp message the recoverable source for every downstream action.

### Email webhook vs inbound email API

An email webhook is the push notification that tells your application a message arrived. The [inbound email API](https://www.mailslurp.com/inbound-email-api/) provides the inbox, message retrieval, attachments, search, and replay controls around that notification. Production systems normally use both.

### Store identifiers before running business logic

Persist the event ID, inbox ID, and message ID, return a success response, then enqueue parsing, CRM updates, ticket creation, or document processing. Treat the event ID as an idempotency key so a retry cannot create the same downstream record twice.

### Fetch content and attachments when the worker needs them

Keep the webhook payload bounded. Workers can retrieve the complete HTML and text body, headers, links, and attachments through the API, then hand the message to[AI email extraction](https://www.mailslurp.com/product/ai-email-parsing-structured-content-extraction/), support routing, or an operations pipeline.

### Make failures visible and recoverable

Failed webhook deliveries retry automatically for 24 hours before exhausted results move to a dead-letter queue. Review delivery history, fix the endpoint, then manually redrive one failed result or all failed results. Use the[ inbound email routing solution](https://www.mailslurp.com/solutions/inbound-email-routing/)when one mailbox needs aliases, queues, review lanes, or multiple destinations.

### Complete the workflow with a controlled reply

After the worker retrieves the message, validates attachments, and completes parsing or routing, send the response from the MailSlurp inbox that received the email. Store the outbound message ID beside the inbound event so support, order, and finance workflows keep a traceable receive-to-reply record.

## Inbound email webhook questions

Direct answers for choosing and operating the event-delivery layer.

How can my application receive email with a webhook?

Create a MailSlurp inbox, register your HTTPS endpoint for new-email events, and store the event and message IDs when MailSlurp posts the payload. Retrieve the full message or attachments through the API when processing begins. [Open the webhook documentation.](https://www.mailslurp.com/docs/webhooks/)

Is an email webhook the same as an inbound email API?

No. The webhook pushes an arrival event to your application. The inbound email API provides inbox creation, message retrieval, attachments, search, routing, and fallback access around that event. [Explore the inbound email API.](https://www.mailslurp.com/inbound-email-api/)

What should an email webhook handler return?

Validate and persist the event, return a successful 2xx response promptly, and move slow parsing or business actions into a worker. This reduces delivery timeouts and makes retries safer.

How does MailSlurp retry a failed webhook?

MailSlurp automatically retries failed webhook deliveries for 24 hours before moving exhausted results to a dead-letter queue. You can inspect delivery history and manually redrive an individual failed result or all failed results after the endpoint recovers.

Can MailSlurp webhooks handle email attachments?

Yes. The event identifies the received email so your worker can fetch attachment metadata and content through the API before storing, validating, parsing, or routing the files.

How do I prevent duplicate processing after a retry?

Persist the webhook event ID and enforce idempotency before creating downstream records. A repeated delivery can then acknowledge the existing event without repeating the business action.
