---
title: "Email to Discord: Forward Inbound Email Automatically"
meta:
  "og:description": "Forward email to Discord automatically. Receive email as JSON, filter senders, safely format the subject and body, and post through a Discord webhook."
  "og:title": "Email to Discord: Forward Inbound Email Automatically"
  description: "Forward email to Discord automatically. Receive email as JSON, filter senders, safely format the subject and body, and post through a Discord webhook."
---

<details>

<summary>

</summary>

Documentation

**Email to Discord**

# **Email to Discord**

Forward email to Discord automatically. Receive email as JSON, filter senders, safely format the subject and body, and post through a Discord webhook.

You get emails you'd rather see in chat — monitoring alerts, contact-form submissions, order confirmations, vendor notifications — and you want them dropped into a **Discord channel** automatically instead of buried in an inbox nobody's watching. The problem: there's no native "email this to Discord" button, and Discord only accepts a specific JSON shape, not a raw email.

[Webhook Relay](https://webhookrelay.com) closes that gap. It gives you an address that **receives inbound email and delivers it as a webhook**, parsing each message into clean JSON. A small transform then reshapes that JSON into the format Discord expects, and the message appears in your channel — no server, no inbox polling, no glue code.

> **Build the message visually:** the free [webhook → Slack/Discord/Teams formatter](https://webhookrelay.com/webhook-message-formatter/) lets you template the Discord embed and copy the transform.

## [How it works](#how-it-works)

Email comes in, gets parsed, gets reshaped, and lands in Discord — a single hop with a transform in the middle:

```
inbound email  ──▶  Webhook Relay (parse)  ──▶  transform to Discord  ──▶  channel
 (any sender)        (email → JSON)             (serverless function)     (message appears)
```

Webhook Relay does the hard part — accepting SMTP, parsing MIME, handling attachments and SPF/DKIM/DMARC — and hands your function a tidy JSON object. The [transform function](https://webhookrelay.com/docs/webhooks/functions/) only has to map a couple of fields. This is the same email side that powers [Email to Webhook](https://webhookrelay.com/email-to-webhook/); here the destination just happens to be Discord.

## [Setup](#setup)

**1. Create a bucket.** In the dashboard, create a bucket — it's the container that ties an input (where email arrives) to outputs (where it's delivered).

**2. Add an email input.** On the bucket, add an _email input_. Webhook Relay gives you a unique address of the form `<uuid>@in.webhookrelay-mail.com`. Anything sent to that address is parsed and POSTed as JSON to the bucket's outputs — see [receive emails as webhooks](https://webhookrelay.com/docs/email/) for the full setup.

**3. Add a Discord output.** In Discord, open **Server Settings → Integrations → Webhooks → New Webhook**, pick the channel, and **Copy Webhook URL**. Paste that URL as the bucket's output destination.

**4. Attach a transform.** Add the [transform function](https://webhookrelay.com/docs/webhooks/functions/) below so the parsed email is reshaped into Discord's `{ content }` format before delivery.

**5. Test.** Send an email to your `<uuid>@in.webhookrelay-mail.com` address. Within a second or two it shows up in your Discord channel. If it doesn't, open the bucket's request log to see exactly what was received and delivered.

## [The transform](#the-transform)

Each email arrives as JSON with fields like `from`, `from_name`, `recipient`, `to`, `cc`, `subject`, `date`, `message_id`, `text`, `html`, `headers`, `spf`, `dkim`, `dmarc`, and `attachments`. See the full [payload reference](https://webhookrelay.com/docs/email/payload/) for every field. In the transform, the body is `r.body` (a string); reshape it and set the new body:

```
const email = JSON.parse(r.body)
const subject = String(email.subject || "(no subject)")
const sender = String(email.from_name || email.from || "unknown sender")
const body = String(email.text || "")

if (email.spf === "fail" || email.dmarc === "fail") {
  r.stopForwarding()
  return
}

const prefix = \`📧 **${subject}**\nFrom: ${sender}\n\n\`
const content = (prefix + body).slice(0, 2000)

r.setBody(JSON.stringify({ content }))
r.setHeader("Content-Type", "application/json")
```

That builds Discord's documented [`content` payload](https://docs.discord.com/developers/resources/webhook) and caps it at Discord's 2,000-character content limit. The SPF/DMARC check is an additional guard, not a replacement for the [From-address allowlist](https://webhookrelay.com/docs/email/filtering-and-policy/).

A Discord incoming webhook accepts either `{ "content": "..." }` or an `embeds` array — so for a richer card, build an `embeds` object instead (map `email.subject` to the title and `email.text` to the description) and Discord will render it with a title, colored sidebar, and fields.

## [Going further](#going-further)

Want only certain senders to reach Discord? Add a From allowlist with [filtering and policy](https://webhookrelay.com/docs/email/filtering-and-policy/) so unwanted mail never gets delivered. And because this is the same inbound-email pipeline behind [Email to Webhook](https://webhookrelay.com/email-to-webhook/), you can point the parsed JSON anywhere — Discord today, Slack, an internal API, or several destinations at once tomorrow.

## [Troubleshooting](#troubleshooting)

- **Discord returns 400:** inspect the transformed delivery. The final request must use `application/json` and contain `content` or a valid `embeds` array.
- **The message is cut off:** the example intentionally respects Discord's content limit. Use an embed for a compact summary or send a link to the full message in approved storage.
- **Messages contain HTML tags:** use the parsed `text` part. Sanitize HTML before using `email.html`.
- **Attachments are missing:** an inbound email attachment is not a Discord attachment upload. Uploading files requires a separate multipart Discord API request and appropriate handling of the decoded content.

[Create a free Webhook Relay account](https://my.webhookrelay.com/register), add an email input, and route your first message into Discord in a few minutes — see the [Email to Webhook](https://webhookrelay.com/email-to-webhook/) pillar for the full picture. Building a Discord [incoming webhook](https://discord.com/developers/docs/resources/webhook)? The format above is everything it needs.

## **Frequently asked questions**

### **Can Discord receive email through a webhook?**

Discord cannot parse an email directly. Webhook Relay receives the message as email, converts it to JSON, and a JavaScript function maps its subject, sender and body to a Discord content or embeds payload.

### **How do I prevent spam from reaching Discord?**

Apply a sender or domain allowlist to the inbound email address, then optionally check the parsed SPF, DKIM and DMARC results in the transform.

### **Why does Discord reject a forwarded email?**

Discord requires a supported JSON field and enforces message limits. Set Content-Type to application/json and truncate content to no more than 2,000 characters, or use a valid embed.

Did this page help you?