Receive support mail as cases over SMTP, HTTP or Cloudflare Email Routing, store attachments in S3, and what sending replies needs.
Each workspace gets a forwarding address on your inbound domain. You forward your support mailbox to it, and every email becomes a message on a case. Rebutdesk can receive mail three ways; pick the one that fits your hosting.
Set the inbound domain
Set INBOUND_EMAIL_DOMAIN to a domain (or subdomain) you control, for example in.example.com. Mailbox addresses look like <mailbox>@in.example.com. Without this variable, the console has no address to show and says “This server cannot receive email yet.”
Create a mailbox
In the console, open Setup, then Support email, and click Create my forwarding address. Rebutdesk creates an address made of your workspace’s company code and a few random characters, for example acme-k3x9@in.example.com. Copy it and, in Gmail, Outlook or your mail host, forward all mail sent to your support address to it.
Receiving: pick a transport
SMTP (Node and Docker)
The Node server runs a receive-only SMTP listener when both INBOUND_EMAIL_DOMAIN and SMTP_PORT are set. Compose sets SMTP_PORT=2525 and publishes it on SMTP_PUBLISH_PORT (default 2525).
- Set
SMTP_PUBLISH_PORT=25in.envso the host listens on the standard port. - Add an MX record for
INBOUND_EMAIL_DOMAINpointing at your server. - Optional: set
SMTP_TLS_CERTandSMTP_TLS_KEYto PEM files mounted into the container to offer STARTTLS.
The listener accepts mail only for addresses on INBOUND_EMAIL_DOMAIN (others get 550 Relaying denied), takes no authentication, and refuses messages over 25 MB (552). If filing a message fails for a temporary reason, it answers 451 so the sending server tries again.
HTTP endpoint (both runtimes)
For mail services and relays that can post raw messages, set INBOUND_EMAIL_SECRET and send each message to POST /api/webhooks/email:
curl -X POST "https://help.example.com/api/webhooks/email?to=acme-k3x9@in.example.com" \
-H "Authorization: Bearer $INBOUND_EMAIL_SECRET" \
-H "Content-Type: message/rfc822" \
--data-binary @message.eml
The body is the raw message (RFC 822). ?to= and ?from= carry the envelope recipient and sender when you know them. Without ?to=, Rebutdesk looks for an address on INBOUND_EMAIL_DOMAIN in the Delivered-To, X-Original-To, To and Cc headers.
| Answer | Meaning |
|---|---|
202 {"ok":true} |
Filed, or ignored on purpose (duplicate or automated mail). |
422 {"error":"rejected","reason":"..."} |
Rejected, for example Unknown mailbox. |
401 |
Wrong or missing bearer token. |
404 |
INBOUND_EMAIL_SECRET is not set. |
413 |
Over 25 MB. |
400 |
Empty body. |
INBOUND_EMAIL_SECRET is one secret for the whole server. For a forwarder that runs somewhere you do not fully control, for example an Email Routing Worker on a shop’s own Cloudflare account, use the per-workspace endpoint instead: POST /api/v1/inbound-email?to=<recipient>&from=<sender> with a workspace API key with the Deliver email only scope. It only files mail on that workspace’s channels, takes the same body and gives the same answers. See REST API.
Cloudflare Email Routing (Workers)
On Workers, route the inbound domain’s catch-all address to the Worker in Email Routing. See Run on Cloudflare Workers.
If your shop’s own domain is also on Cloudflare, you can skip the forward: add an Email Routing rule that sends the support address itself (for example help@shop.example) to the Worker. Once that address’s domain is verified in the Support email step, mail to it is filed on the workspace that verified it. Before verification it is refused as an unknown mailbox.
Catch-all
A channel files mail sent to any address on its support address’s domain (for example sales@shop.example), not only the support address itself, so adding the domain is enough: route the domain’s catch-all to Rebutdesk and every address arrives. Mail to the support address itself always goes to its own channel first. Turn off Accept mail to any address on /api/webhooks/email this needs a verified domain; through /api/v1/inbound-email the API key already proves the workspace.
How mail becomes a case
- Threading. A message joins an existing case when its
In-Reply-ToorReferencespoint to an earlier message on that case. Failing that, a[#123]case number in the subject from the same sender joins case 123. - New cases. Otherwise a new case opens, tagged
email, with the subject cleaned ofRe:andFwd:prefixes. - Closed cases are not reopened by email: a reply to a closed case opens a new one. Pending and resolved cases go back to open.
- Quoted text (“On … wrote:”, Outlook headers, quoted
>blocks, signatures after--) is cut, so the timeline shows only the new part. - Duplicates with a Message-ID already seen are ignored.
- Automated mail is ignored and never opens a case: auto-replies (
Auto-Submitted), bulk and list mail (Precedence,List-Id,List-Unsubscribe),X-AutoreplyandX-Autorespond, and senders such asmailer-daemon@,postmaster@andnoreply@. - Unknown or disabled mailboxes are rejected back to the sender with “Unknown mailbox”.
Attachments
Attachments are stored in any S3-compatible bucket: AWS S3, Cloudflare R2, MinIO and others. Set S3_BUCKET, S3_ACCESS_KEY_ID and S3_SECRET_ACCESS_KEY, plus S3_ENDPOINT for anything that is not AWS. See Configuration.
- Up to 10 attachments per message are stored, each up to 10 MB. Larger ones are skipped.
- Objects are stored under
<workspace id>/<event id>/<n>-<file name>. - If an upload fails, the message is still filed without that attachment.
- Without a bucket, attachments are skipped and the message text is still filed.
The console does not list or open stored attachments yet. They are recorded in the database and kept in your bucket.
Teach the AI from past mail
On the same Support email step, Teach the AI from past emails (optional) imports an .mbox export of your mailbox (Google Takeout for Gmail, or your mail app’s export), up to 20 MB. Enter the Address your team replies from first, so team replies can be told apart from buyers, then Choose .mbox file (up to 20 MB). Up to 500 conversations that contain both a buyer message and a team reply are queued, and the AI turns them into general questions and answers. This needs an AI model; see AI.
Sending replies
Replies you write on an email case are always saved on the case’s timeline. Sending them as email needs outbound mail, which you set up with one of these:
| Option | Runtime | Settings |
|---|---|---|
| Any SMTP relay (Postmark, Mailgun, SES SMTP, your own server) | Node and Docker | MAIL_SMTP_URL, for example smtps://user:pass@smtp.example.com:465 or smtp://user:pass@smtp.example.com:587 |
| Amazon SES over its HTTP API | Node, Docker and Workers | AWS_SES_ACCESS_KEY_ID, AWS_SES_SECRET_ACCESS_KEY, AWS_SES_REGION |
| Cloudflare Email Service over its REST API | Node, Docker and Workers | CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_EMAIL_API_TOKEN (permissions Email Sending: Edit and Zone: Read) |
| Cloudflare Email Service through the Worker binding | Workers | a send_email binding named SEND_EMAIL in wrangler.jsonc |
| Resend | Node, Docker and Workers | RESEND_API_KEY |
Workers cannot open SMTP connections, so use SES, Cloudflare or Resend there. Several can be set at once. None is needed for replies when each support address brings its own account (below).
Choosing a transport per domain
Each support address picks how its replies are sent: Send replies with in the Support email step, or transport in the REST API. There is no default; the choice is required with a new support address. The options are the transports configured on the server, plus Amazon SES, Cloudflare (API token) and Resend with the domain’s own account:
- Cloudflare Email Service (Worker binding). Offered when the Worker has the
SEND_EMAILbinding. The domain must be onboarded for Email Sending in the Worker’s own account. The binding cannot look domains up, so only the ownership TXT record is checked, unless the server also hasCLOUDFLARE_ACCOUNT_IDandCLOUDFLARE_EMAIL_API_TOKEN, which are then used to confirm onboarding. - Cloudflare Email Service (API token). Enter the account ID and an API token with Email Sending: Edit and Zone: Read. Turn on Email Sending for the domain in that account first. When the server has its own Cloudflare account, leave both empty for domains on it.
- Resend. Enter an API key with full access. The domain is added to that Resend account and the step shows its DKIM and SPF records. With
RESEND_API_KEYon the server, the key may stay empty. - Amazon SES. Enter an access key ID, secret access key and region of an IAM user allowed to use SES. The domain is added as an SES identity in that region (Easy DKIM) and the step shows its DKIM records. The account must be out of the SES sandbox to reach buyers. With the server’s own SES keys, the fields may stay empty.
- Keys are checked first. New credentials are tried against their provider before anything is saved, so a wrong key shows the provider’s message and nothing changes. They are stored encrypted with
BETTER_AUTH_SECRETand never shown again. - Several support addresses. Add another support address in the Support email step adds one more address with its own forwarding address, domain and transport. Each shows whether its domain is verified. Removing one keeps its cases.
- Changing the transport or the account verifies the domain again. The ownership TXT record stays the same; until the check passes, replies are not sent.
System mail (sign-in codes, invitations) and channels set up before the server offered a choice use one transport: MAIL_TRANSPORT, or when unset SMTP, SES, Cloudflare, the binding, then Resend. Set MAIL_TRANSPORT before adding a second transport, so those channels keep sending the way they did.
Without outbound mail, each reply on an email case shows “Not sent by email: Email sending is not set up on this server.” under it, and the buyer does not receive it.
With SMTP and INBOUND_EMAIL_DOMAIN set, a reply is sent:
- from the mailbox’s display name (by default “
Support”) at the forwarding address, with Reply-Toset to that address, so the buyer’s answer comes back to the same case; - with the subject
Re: <case subject> [#<case number>]andIn-Reply-ToandReferencesheaders, so mail clients and Rebutdesk keep the thread.
Your SMTP relay must accept the forwarding address’s domain (INBOUND_EMAIL_DOMAIN) as a sender, so verify that domain with your provider.
With SES or Cloudflare, which can verify sending domains, the Support email step asks for Your support address and shows DNS records to add instead: a TXT record that proves the domain is yours, the mailer’s DKIM records, and an optional DMARC record. Replies then come from your own address once the domain is verified. With Cloudflare there are no DNS records to copy: the domain must be a zone in the same Cloudflare account with Email Sending turned on (Email Service, Email Sending, Onboard domain), and the TXT record is still required. Addresses on shared mail providers such as gmail.com or outlook.com are refused there, because you cannot add DNS records for them.
With SES and AWS_SES_MAIL_FROM_SUBDOMAIN set, the records also include an optional MX and SPF TXT record on <subdomain>.<domain>. With them, bounces go to your domain and SPF passes for it as well as DKIM.
Sign-in code emails are sent from MAIL_FROM.
Reading a mailbox over IMAP (plugin)
With the IMAP plugin license (a paid plugin, in the Pro build for Node and Docker), the Support email step shows Or read the mailbox directly (IMAP). Enter the support address, the IMAP server, port, login and password (for Gmail and Outlook, an app password), and the folder, usually INBOX. Rebutdesk logs in once before saving, so a wrong password or server is reported right away.
- Every minute the server reads new mail in that folder and files it like forwarded mail: threading, the automated-mail filter and attachments all apply. Up to 50 messages per mailbox per minute.
- Mail already in the folder when you connect stays there; only what arrives afterwards becomes cases. Filed messages are marked as read.
- If a message cannot be filed (for example the database is briefly unavailable), reading stops at that message and starts there again a minute later, so nothing is skipped.
- Replies on these cases are sent from the support address through the server’s outgoing mail (
MAIL_SMTP_URLor SES), so the relay must accept that address as a sender. With Gmail,MAIL_SMTP_URL=smtps://you%40gmail.com:<app password>@smtp.gmail.com:465works. - The password is stored encrypted with
BETTER_AUTH_SECRETand is never shown again. The step shows when the mailbox was last read and the last error. - IMAP needs a long-running server, so it is not available on Cloudflare Workers; use forwarding or Email Routing there.
Next: Stripe and PayPal