Email Channel Setup
Operator setup for the email channel on a self-hosted answerLoops deployment. Connect inbound mail, sending credentials and optional Gmail or Outlook mailbox connections.
The email channel turns messages sent to a support address into tickets, drafts an answer from your knowledge base, and replies in the same email thread. It does not poll an inbox. Instead, an email service tells answerLoops the moment a message arrives.
This page is the operator side for a self-hosted deployment: the credentials, the inbound webhook and the optional Gmail and Outlook apps. When you are done, mail sent to your support address becomes a ticket. Choosing a sending domain, allowed senders, escalation email and Automatic Deflections are covered in the Email integration guide.
How an inbound email flows
A customer reply to a conversation that already has a ticket is added to that ticket and your team is notified. It does not trigger a second automatic answer.
Set up inbound email
Add the variables below to the app service and restart it. RESEND_API_KEY and RESEND_FROM handle outbound replies. RESEND_WEBHOOK_SECRET is what lets the app accept Resend's events.
RESEND_API_KEY=<your-resend-api-key>
RESEND_FROM=<support@your-domain>
RESEND_WEBHOOK_SECRET=<signing-secret-from-your-resend-webhook>In Integrations → Email, choose Use your own domain, enter the domain (or a support subdomain), and add the DKIM, return-path and inbound MX records shown at your DNS host. If the root domain's MX records already belong to Google Workspace or Microsoft 365, use a support subdomain so company mail is not redirected. Click Check verification status once DNS has propagated. The integration guide has the full flow.
In your Resend dashboard, add a webhook that posts to the address below, with the signing secret you put in RESEND_WEBHOOK_SECRET.
<your-app-url>/api/email/ingestSubscribe to email.received, email.bounced and email.complained. Any other email. event is recorded as a delivery failure, so leave success events such as email.delivered unsubscribed.
Email your support address. A ticket should appear in Tickets within a few seconds with the source badge "Email from" and the sender's address. Reply from the same inbox and the message is added to that ticket.
Mail is only accepted for a domain that is verified in answerLoops. Mail to any other domain is ignored without an error.
Bring your own inbound provider
If you already receive mail through another service, it can post inbound messages to the same address instead of Resend. This route is optional. Each request must carry the organization's email webhook secret in an X-Email-Webhook-Secret header, and the body can be JSON or a form post with the sender, subject and text or HTML. The provider steps below come from each provider's own dashboard, so check its current documentation if a menu has moved.
- Open Settings → Inbound Parse and choose Add Host & URL.
- Enter your domain and
<your-app-url>/api/email/ingest. - Add the
X-Email-Webhook-Secretheader in the HTTP POST settings.
Optional: let people reply from their own mailbox
By default replies go out from your verified domain or RESEND_FROM. An organization can instead connect a Gmail or Outlook mailbox so replies are sent through it. That needs an OAuth app that you register once for the whole deployment. Each app asks only for permission to send mail, never to read an inbox. Only one mailbox connection exists per organization, so connecting Outlook replaces a connected Gmail mailbox and the other way round. Without the variables for a provider, its connect button is unavailable and nothing else is affected.
In Google Cloud, create a project, configure an OAuth consent screen, and create OAuth 2.0 credentials that request only the gmail.send scope.
Add <your-app-url>/api/email/gmail/callback as an authorized redirect URI.
Set GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET on the app service. Set GMAIL_REDIRECT_URI only if your callback address differs from the one derived from AUTH_URL.
Google must review the consent screen before people outside your own testing can connect. Start this as soon as the screen exists.
Environment variables
| Variable | Required | What it does |
|---|---|---|
RESEND_API_KEY | Yes | Sending replies, domain verification and retrieving received mail. The key needs domain access as well as sending |
RESEND_FROM | Yes | Default reply-from address, used when no custom domain or mailbox is set |
RESEND_WEBHOOK_SECRET | Yes, for Resend inbound | Signing secret from your Resend webhook. Without it inbound events from Resend are rejected, and bounce and complaint tracking is unavailable |
GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET | For Connect Gmail | Google Cloud OAuth client credentials |
GMAIL_REDIRECT_URI | No | Overrides the derived callback <AUTH_URL or NEXTAUTH_URL>/api/email/gmail/callback |
OUTLOOK_CLIENT_ID and OUTLOOK_CLIENT_SECRET | For Connect Outlook | Microsoft Entra app registration credentials |
OUTLOOK_REDIRECT_URI | No | Overrides the derived callback <AUTH_URL or NEXTAUTH_URL>/api/email/outlook/callback |
What the customer sees
The customer emails your support address and, depending on your settings, either gets an answer in the same email thread or waits for your team. Their reply to that thread lands on the same ticket. See the Email integration guide for the full customer-facing behavior.