---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/sendgrid/for-developers/parsing-email/inbound-email#article
headline: Inbound Email Parse Webhook
description: Utilize SendGrid's Parse API to parse incoming emails and attachments efficiently. Mitigate data loss and ensure email delivery success.
url: https://www.twilio.com/docs/sendgrid/for-developers/parsing-email/inbound-email
inLanguage: en
dateModified: 2026-07-17T03:36:59.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# Inbound Email Parse Webhook

SendGrid can parse the attachments and contents of incoming emails. Application examples include receiving uploads and posting blog articles via email.

The Parse API will `POST` the parsed email to a URL that you specify. If a `POST` is unsuccessful, SendGrid automatically queues and retries any `POSTs` that respond with a `5XX` status. This prevents data loss for customers who have misconfigured their website or `POST` URL.

> \[!NOTE]
>
> Respond with a 2xx status to the `POST` request to stop the email from retrying.

To avoid returning an error your link must return a `2xx` HTTP code when the email is received. This response lets our system know that your link has received the email. It is then removed from our send queue. If we do **not** get a valid `2xx` HTTP response, our servers will believe they have failed to deliver your message. Messages that cannot be delivered after 3 days will be dropped. SendGrid will not send a notification before the message is dropped.

## Setup

The following steps are required to begin parsing email:

* Point the MX Record of a Domain/Hostname or Subdomain to **mx.sendgrid.net**
* Associate the Domain/Hostname and the URL in the [Parse API settings page](https://sendgrid.com/developer/reply/).

> \[!WARNING]
>
> The Inbound Parse Webhook will not follow redirects. Please make sure to use the correct URL, or posting will fail.

You must ensure that the subdomain-domain combination for your receiving domain is unique.

> \[!WARNING]
>
> Only authenticated domains may be used when configuring Inbound Parse!

See [Setting Up The Inbound Parse Webhook](/docs/sendgrid/for-developers/parsing-email/setting-up-the-inbound-parse-webhook/) for step-by-step instructions.

> \[!NOTE]
>
> The total message size limit, including the message itself and any number of attachments, is 30MB. Be aware that other mail handlers will have their own limitations, and some ISPs and companies may either dramatically limit the size and/or type of attachments, or even block them altogether.

## Character sets and header decoding

When you receive an email that isn't in ASCII-only format, SendGrid decodes the headers so you can parse the message more easily. Messages and their headers can have character set data associated with them. To simplify parsing, SendGrid decodes the `to`, `from`, `cc`, and `subject` headers when needed and converts all headers to UTF-8 for uniformity, since a header can technically use many different character sets.

The `charsets` variable contains a JSON-encoded hash of the header or field name and its respective character set. For example, it might look like this:

```ruby {title="Example charsets value"}
[charsets] => {"to":"UTF-8","cc":"UTF-8","subject":"UTF-8","from":"UTF-8","text":"iso-8859-1"}
```

This shows that you should treat all headers as UTF-8, and the text body is latin1.
