Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .references/inbound-email.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Last reviewed: 2026-10-20

## Pipeline

1. Mail arrives at `inbound-smtp.<INBOUND_REGION>.amazonaws.com` (the MX for the hosted domain and every customer receiving subdomain).
1. Mail arrives at `inbound-smtp.<INBOUND_REGION>.amazonaws.com` (the MX for the hosted domain and every customer receiving domain or subdomain).
2. The active SES receipt rule set `bytesend-inbound`, rule `bytesend-store-and-notify`, matches every recipient. It writes the raw MIME to `s3://<INBOUND_S3_BUCKET>/raw/<sesMessageId>` and publishes to `INBOUND_SNS_TOPIC_ARN`. Spam and virus scanning are on.
3. SNS posts to `/api/inbound_callback`. The route only trusts `INBOUND_SNS_TOPIC_ARN` (403 otherwise), confirms subscriptions itself from that ARN, and queues `Received` notifications on `inbound-email` (job id = SES message id, 5 attempts, exponential backoff).
4. `processInbound` (`apps/web/src/server/service/inbound-service.ts`):
- resolves each recipient to a team: `slug(+tag)@INBOUND_HOSTED_DOMAIN`, or `*@<inboundSubdomain>.<domain>` for domains with `inboundEnabled`. Unknown recipients are dropped silently;
- resolves each recipient to a team: `slug(+tag)@INBOUND_HOSTED_DOMAIN`, or `*@<inboundSubdomain>.<domain>` for domains with `inboundEnabled`, or `*@<domain>` when `inboundSubdomain` is `@` (receiving on the domain itself). A subdomain setup wins over a root setup with the same name. Unknown recipients are dropped silently;
- skips duplicates (`sesMessageId` is `<sesId>:<teamId>`), and drops mail over the plan's `inboundEmailsPerMonth`;
- parses with mailparser, stores attachments at `attachments/<teamId>/<inboundId>/<attId>`, links replies through `In-Reply-To`/`References` to `Email.sesEmailId`;
- runs forwarding rules (never when the virus verdict is `fail`), then emits `email.received`.
5. The `inbound-cleanup` job runs daily at 03:40 UTC and deletes rows past `expiresAt` (30 days) with their raw message and attachments.
6. Mail to `<slug>+dmarc@<hosted>` or `dmarc@<receiving subdomain>` skips the inbox and the allowance. `dmarc-service.ts` reads it only when SES's SPF or DKIM verdict passed, unpacks `.xml`, `.gz` and `.zip` attachments (each capped at 25 MB inflated), and stores reports for domains the team owns, at most 2,000 a day per team. The raw message is deleted straight away. Reports are kept 90 days and removed by the same cleanup job.
6. Mail to `<slug>+dmarc@<hosted>` or `dmarc@<receiving domain or subdomain>` skips the inbox and the allowance. `dmarc-service.ts` reads it only when SES's SPF or DKIM verdict passed, unpacks `.xml`, `.gz` and `.zip` attachments (each capped at 25 MB inflated), and stores reports for domains the team owns, at most 2,000 a day per team. The raw message is deleted straight away. Reports are kept 90 days and removed by the same cleanup job.

Attachment links are `/api/inbound/attachments/<emailId>/<attId>?expires&sig`, HMAC-SHA256 with `NEXTAUTH_SECRET`, valid for one hour, always served as downloads with `nosniff`.

Expand Down Expand Up @@ -55,13 +55,13 @@ Use one region that supports SES receiving (for example `us-east-1`, `us-west-2`
*._report._dmarc.<INBOUND_HOSTED_DOMAIN> TXT "v=DMARC1"
```

Addresses on a customer's own receiving subdomain (`dmarc@reply.acme.com`) need nothing extra.
Addresses on a customer's own receiving domain or subdomain (`dmarc@reply.acme.com`, `dmarc@acme.com`) need nothing extra.

7. **Receipt rule**: Admin → SES regions → Receiving → **Create receiving rule**. It creates or updates the rule and makes the rule set active, and is safe to run again. Only one receipt rule set can be active per account and region, so this replaces any other active set there.

## Customer domains

`enableReceiving` (`inbound-domain-service.ts`) needs a verified sending domain and a single-label subdomain. If the domain sends from `INBOUND_REGION`, its existing identity covers the subdomain and the customer adds only the MX. Otherwise the app creates a separate identity for `<sub>.<domain>` in `INBOUND_REGION` with a new DKIM key under the selector `bytesend-inbound`, and the customer also adds that TXT record. `checkReceiving` looks up the MX and the identity's status. Disabling deletes the separate identity.
`enableReceiving` (`inbound-domain-service.ts`) needs a verified sending domain and either a single-label subdomain or `@` for the domain itself. `@` takes over all of the domain's mail, so it needs `confirmRoot`, and the UI shows the domain's current MX hosts (`currentMailHosts`) first. If the domain sends from `INBOUND_REGION`, its existing identity covers the receiving host and the customer adds only the MX. Otherwise the app creates a separate identity for the receiving host in `INBOUND_REGION` (reusing an already-verified one for `@`) with a new DKIM key under the selector `bytesend-inbound`, and the customer also adds that TXT record. `checkReceiving` looks up the MX and the identity's status. Disabling deletes the separate identity.

## Limits

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/guides/dmarc-reports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You need this before moving your DMARC policy from `p=none` to `quarantine` or `
</Steps>

<Note>
Your report address is your team's hosted address with `+dmarc`. If you [receive on a subdomain](/guides/inbound-email#receiving-on-your-own-domain) of the same domain, `dmarc@<that subdomain>` is used instead.
Your report address is your team's hosted address with `+dmarc`. If you [receive on your own domain](/guides/inbound-email#receiving-on-your-own-domain), `dmarc@` that domain or subdomain is used instead, such as `dmarc@reply.acme.com` or `dmarc@acme.com`.
</Note>

## Reading the results
Expand Down
12 changes: 11 additions & 1 deletion apps/docs/guides/inbound-email.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Anything after a `+` still reaches you, so you can tell senders apart: `acme+ord

## Receiving on your own domain

You receive on a **subdomain** of a domain you already send from, such as `reply.acme.com`. Only that subdomain's mail comes to ByteSend: your normal mailboxes on `acme.com` (Google Workspace, Microsoft 365 and so on) keep working.
Most teams receive on a **subdomain** of a domain they already send from, such as `reply.acme.com`. Only that subdomain's mail comes to ByteSend, so your normal mailboxes on `acme.com` (Google Workspace, Microsoft 365 and so on) keep working. You can also [receive on the domain itself](#receiving-on-the-domain-itself).

<Steps>
<Step title="Pick a subdomain">
Expand Down Expand Up @@ -169,6 +169,16 @@ Under **Inbox → Forwarding**, forward mail to another address. A rule matches:

Forwarded mail is sent from `forwarding@` your verified domain, with the original sender as the reply-to address, so replying from your mailbox goes to the right person. Forwarded mail counts toward your sending.

### Reply as your address from Gmail or Outlook

Forward an address like `hey@acme.com` to your own mailbox, then reply *as* that address through ByteSend's SMTP relay, signed with your domain's DKIM:

1. Add a forwarding rule from `hey` to your Gmail or Outlook address.
2. In Gmail, open **Settings → Accounts → Send mail as → Add another email address**. In Outlook, add it as a send-from address.
3. Enter `hey@acme.com`, then the SMTP server `smtp.bytesend.cloud`, port `587` with TLS, your SMTP username from **Settings → SMTP**, and an API key as the password.

This suits a few personal addresses. ByteSend doesn't host mailboxes, so there's no IMAP access, and received mail is kept for 30 days.

## Limits

| Plan | Received each month |
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/(dashboard)/dmarc/dmarc-setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function DmarcSetup({ setup, isLoading }: { setup?: Setup; isLoading: boo
) : null}
{!domain.address ? (
<p className="text-muted-foreground">
Set up receiving on a subdomain of {domain.orgDomain} in the <Link href="/inbox?tab=addresses" className="text-foreground underline">Inbox</Link> to get a report
Set up receiving on {domain.orgDomain} or one of its subdomains in the <Link href="/inbox?tab=addresses" className="text-foreground underline">Inbox</Link> to get a report
address.
</p>
) : (
Expand Down
11 changes: 8 additions & 3 deletions apps/web/src/app/(marketing)/receiving/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const STEPS = [
{
icon: AtSign,
title: "Pick an address",
text: "Use your team's hosted address straight away, or receive on a subdomain of your own domain like reply.yourapp.com with one MX record.",
text: "Use your team's hosted address straight away, or receive on your own domain, either a subdomain like reply.yourapp.com or the domain itself, with one MX record.",
},
{
icon: ShieldCheck,
Expand Down Expand Up @@ -101,7 +101,7 @@ for (const file of attachments) {
];

const DETAILS = [
{ title: "+tags on every address", text: "acme+orders@ and acme+invoices@ both arrive, so you can tell senders apart without new addresses." },
{ title: "Any address you like", text: "A hosted address with no setup, a subdomain like reply.yourapp.com, or your domain itself like hey@yourapp.com. +tags such as acme+orders@ work everywhere." },
{ title: "Authentication results", text: "Every message shows whether SPF, DKIM and DMARC passed, plus spam and virus verdicts." },
{ title: "Signed webhooks", text: "Each delivery is signed and retried until your endpoint accepts it." },
{ title: "Kept for 30 days", text: "Messages and attachments stay in your inbox and API for 30 days, then they're deleted." },
Expand Down Expand Up @@ -194,7 +194,12 @@ export default async function ReceivingPage() {
</Section>

<Section>
<SectionHeader eyebrow="The details" title="Everything you'd want from an inbox API" align="left" />
<SectionHeader
eyebrow="The details"
title="Everything you'd want from an inbox API"
description="Great for app mail and a few personal addresses. It isn't a replacement for Google Workspace or Microsoft 365 mailboxes."
align="left"
/>
<HairlineGrid className="grid-cols-1 sm:grid-cols-2 lg:grid-cols-3">
{DETAILS.map((detail) => (
<div key={detail.title} className="p-6">
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/marketing/Features.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const features: Feature[] = [
{
icon: Inbox,
title: "Inbound email",
description: "Receive mail on your own domain or a hosted address. Get it by webhook or API, read it in the inbox, or forward it on.",
description: "Receive mail on a hosted address, a subdomain like reply.yourapp.com, or your domain itself. Get it by webhook or API, read it in the inbox, or forward it on.",
tone: "teal",
},
{
Expand Down
Loading