# Setting up a support inbox

**URL:** https://meta.discourse.org/t/setting-up-a-support-inbox/251825
**Category:** Support
**Tags:** email
**Created:** [January 12, 2023, 3:56pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825 "2023-01-12T15:56:43Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![jeffbyrnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeffbyrnes/32/121097_2.png) [@jeffbyrnes](https://meta.discourse.org/u/jeffbyrnes)
#### Post date: [January 12, 2023, 3:56pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/1 "2023-01-12T15:56:43Z")

</div>

Hey y’all, just came across this blog post [How Does Team Discourse Use Discourse?](https://meta.discourse.org/t/how-does-team-discourse-use-discourse/82176), and this stuck out to me:

> Anyone can email [team@discourse.org](mailto:team@discourse.org) and we handle those interactions in a central discourse mailbox, as private group messages.

How did y’all set that up? I would _love_ to do this for [steering@somervilleyimby.org](mailto:steering@somervilleyimby.org) (we currently use a Google Group & it’s pretty awkward). I use Google Apps for emails received by & sent from `somervilleyimby.org`, and Mailgun to handle Discourse emails (e.g., [jeff@somervilleyimby.org](mailto:jeff@somervilleyimby.org); these are sent/received via `discourse.somervilleyimby.org`) so I’m a little unclear how I might set this up.

Any suggestions or perhaps a HOWTO? I spotted [Configuring incoming email to create new topics or group messages](https://meta.discourse.org/t/configure-incoming-email-to-create-new-topics-or-group-messages/62977), but that only gets me partway.

---

<div class="post-metadata">

### Author: ![HAWK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hawk/32/86627_2.png) [@HAWK](https://meta.discourse.org/u/HAWK)
#### Post date: [January 12, 2023, 9:53pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/2 "2023-01-12T21:53:20Z")

</div>

Hi ya. Did you see [Discourse as a private email support portal](https://meta.discourse.org/t/discourse-as-a-private-email-support-portal/34444)

---

<div class="post-metadata">

### Author: ![jeffbyrnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeffbyrnes/32/121097_2.png) [@jeffbyrnes](https://meta.discourse.org/u/jeffbyrnes)
#### Post date: [January 14, 2023, 4:52pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/3 "2023-01-14T16:52:21Z")

</div>

Ah nice nice! That’s a good read, but it doesn’t clarify the critical element I’m missing:

How do I get [steering@somervilleyimby.org](mailto:steering@somervilleyimby.org) to end up at a Group in our Discourse?

Right now, the `somervilleyimby.org` domain is mapped to Google Apps email, and we have these two addresses:

- [jeff@somervilleyimby.org](mailto:jeff@somervilleyimby.org) (my address)
- [steering@somervilleyimby.org](mailto:steering@somervilleyimby.org) (Google Groups address)

Inbound & outbound email from our Discourse uses `discourse.somervilleyimby.org` via Mailgun, and is configured well.

But how would I map an email address on the main domain to be received by a Group inside Discourse?

I realize this is maybe outside the scope of Discourse itself, but figured someone might have an idea, and I suspect there are individual `person@discourse.org` addresses while _also_ a shared `team@discourse.org` address that lands inside Team Discourse’s instance.

---

<div class="post-metadata">

### Author: ![hosch](https://avatars.discourse-cdn.com/v4/letter/h/22d042/32.png) [@hosch](https://meta.discourse.org/u/hosch)
#### Post date: [January 14, 2023, 6:26pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/4 "2023-01-14T18:26:43Z")

</div>

Would an email redirect to [someaddress@discourse.somervilleyimby.org](mailto:someaddress@discourse.somervilleyimby.org) work?

---

<div class="post-metadata">

### Author: ![jeffbyrnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeffbyrnes/32/121097_2.png) [@jeffbyrnes](https://meta.discourse.org/u/jeffbyrnes)
#### Post date: [January 14, 2023, 6:27pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/5 "2023-01-14T18:27:35Z")

</div>

I thought of that, still trying to piece together exactly _how_ I’d wire that up though 🤔

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [January 14, 2023, 8:04pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/6 "2023-01-14T20:04:18Z")

</div>

Hi Jeff 🙂

I’m not 100% sure I’m following you right, but I use the [mail-receiver](https://meta.discourse.org/t/configure-direct-delivery-incoming-email-for-self-hosted-sites/49487) on my self-hosted site to handle the incoming emails, and allow email-in in the admin settings, then set an email address in the group/category settings for where I want something to end up.

Does any of that sound helpful?

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [January 14, 2023, 8:37pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/7 "2023-01-14T20:37:55Z")

</div>

The problem with mail receiver though is that it handles a single domain.

Jeff currently uses a subdomain for the instance while wanting a mailbox at the root domain to also be handled.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 15, 2023, 11:14am UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/8 "2023-01-15T11:14:58Z")

</div>

So he’d need to set up the mail receiver on a different subdomain, and then forward the mail from the real one to the discourse one. (this should get split to its own topic)

---

<div class="post-metadata">

### Author: ![jeffbyrnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeffbyrnes/32/121097_2.png) [@jeffbyrnes](https://meta.discourse.org/u/jeffbyrnes)
#### Post date: [January 17, 2023, 10:26pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/9 "2023-01-17T22:26:42Z")

</div>

Thanks everyone, and appreciate breaking this out to its own topic.

@JammyDodger that def. sounds like it would do the trick, and @pfaffman sounds like he’s right on the money with how I could handle my domain + subdomain setup.

If anyone is curious, the subdomain is what Mailgun suggests as best practice if you already have email on your domain handled by another entity (Google Apps, in our case).

tl;dr Email remains _very_ hard.

---

<div class="post-metadata">

### Author: ![jeffbyrnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeffbyrnes/32/121097_2.png) [@jeffbyrnes](https://meta.discourse.org/u/jeffbyrnes)
#### Post date: [January 18, 2023, 5:22pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/10 "2023-01-18T17:22:23Z")

</div>

So I figured out I can use Gmail routing rules to reroute email to `steering@discourse.somervilleyimby.org`, and Mailgun then POSTs that to my Mailgun plugin’s endpoint, `/mailgun/incoming` but they throw `422 Unprocessable Entity` errors 🤔

Guess I gotta dive in to the plugin code a bit…

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 18, 2023, 5:45pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/11 "2023-01-18T17:45:51Z")

</div>

If you’re not using mailgun to receive mail for your forum subdomain, I’d delete the mailgun MXs and use the [Configure direct-delivery incoming email for self-hosted sites](https://meta.discourse.org/t/configure-direct-delivery-incoming-email-for-self-hosted-sites/49487).

---

<div class="post-metadata">

### Author: ![jeffbyrnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeffbyrnes/32/121097_2.png) [@jeffbyrnes](https://meta.discourse.org/u/jeffbyrnes)
#### Post date: [January 18, 2023, 6:07pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/12 "2023-01-18T18:07:58Z")

</div>

So I am using Mailgun for that, which clearly complicates this. But also don’t actually want to handle my own email b/c it’s just me handling admin.

Nonetheless y’all pointed me in the right direction!

---

<div class="post-metadata">

### Author: ![jeffbyrnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeffbyrnes/32/121097_2.png) [@jeffbyrnes](https://meta.discourse.org/u/jeffbyrnes)
#### Post date: [January 18, 2023, 8:27pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/13 "2023-01-18T20:27:22Z")

</div>

/me sighs

Of course, this would all probably be less complicated if the upgrade to Discourse 3.x didn’t appear to break incoming email via the Mailgun plugin entirely 😞

> **An error I’m seeing**
>
> From the logs:
> 
> ```plaintext
> # env tab
> hostname	discourse-app
> process_id	9406
> application_version	3030a538192252c9d29e4fb763d31810327f370a
> HTTP_HOST	discourse.somervilleyimby.org
> REQUEST_URI	/mailgun/incoming
> REQUEST_METHOD	POST
> HTTP_USER_AGENT	Go-http-client/2.0
> HTTP_ACCEPT	*/*
> HTTP_X_FORWARDED_FOR	<redacted>
> HTTP_X_REAL_IP	<redacted>
> time	2:59 pm
> 
> ```
> 
> ```plaintext
> # info
> Message (27 copies reported)
> 
> ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity.)
> lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
> lib/content_security_policy/middleware.rb:12:in `call'
> lib/middleware/anonymous_cache.rb:366:in `call'
> config/initializers/100-quiet_logger.rb:20:in `call'
> config/initializers/100-silence_logger.rb:29:in `call'
> lib/middleware/enforce_hostname.rb:24:in `call'
> lib/middleware/request_tracker.rb:228:in `call'
> 
> Backtrace
> 
> actionpack (7.0.3.1) lib/action_controller/metal/request_forgery_protection.rb:251:in `handle_unverified_request'
> actionpack (7.0.3.1) lib/action_controller/metal/request_forgery_protection.rb:284:in `handle_unverified_request'
> actionpack (7.0.3.1) lib/action_controller/metal/request_forgery_protection.rb:273:in `verify_authenticity_token'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:400:in `block in make_lambda'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:199:in `block (2 levels) in halting'
> actionpack (7.0.3.1) lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:200:in `block in halting'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:595:in `block in invoke_before'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:595:in `each'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:595:in `invoke_before'
> 
> Env
> 
> HTTP HOSTS: discourse.somervilleyimby.org
> 
> ```
> 
> ```plaintext
> # backtrace
> Message (26 copies reported)
> 
> ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity.)
> lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
> lib/content_security_policy/middleware.rb:12:in `call'
> lib/middleware/anonymous_cache.rb:366:in `call'
> config/initializers/100-quiet_logger.rb:20:in `call'
> config/initializers/100-silence_logger.rb:29:in `call'
> lib/middleware/enforce_hostname.rb:24:in `call'
> lib/middleware/request_tracker.rb:228:in `call'
> 
> Backtrace
> 
> actionpack (7.0.3.1) lib/action_controller/metal/request_forgery_protection.rb:251:in `handle_unverified_request'
> actionpack (7.0.3.1) lib/action_controller/metal/request_forgery_protection.rb:284:in `handle_unverified_request'
> actionpack (7.0.3.1) lib/action_controller/metal/request_forgery_protection.rb:273:in `verify_authenticity_token'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:400:in `block in make_lambda'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:199:in `block (2 levels) in halting'
> actionpack (7.0.3.1) lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:200:in `block in halting'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:595:in `block in invoke_before'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:595:in `each'
> activesupport (7.0.3.1) lib/active_support/callbacks.rb:595:in `invoke_before'
> 
> Env
> 
> HTTP HOSTS: discourse.somervilleyimby.org
> 
> ```

Gonna go see if there’s any other reports of similar, but if any of y’all have ideas I welcome them!

---

<div class="post-metadata">

### Author: ![jeffbyrnes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jeffbyrnes/32/121097_2.png) [@jeffbyrnes](https://meta.discourse.org/u/jeffbyrnes)
#### Post date: [January 18, 2023, 10:32pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/14 "2023-01-18T22:32:20Z")

</div>

I got it! Ok, cool, so first, the upgrade to Discourse v3.x + my out of date Mailgun plugin got in the way.

Anyway, the HOW:

1. Set up a [Mailgun Receiving Route](https://app.mailgun.com/app/receiving/routes) for the address or RegEx pattern for receiving incoming email
2. Visit Google Admin
3. On the left navigation, expand “Apps”, then “Google Workspace”, and click [“Gmail”](https://admin.google.com/u/2/ac/managedsettings/740348119625) (this link might work?(
4. Click [Default routing](https://admin.google.com/u/2/ac/apps/gmail/defaultrouting)
5. Create a route that maps the address or pattern on your main domain to your Mailgun-powered subdomain:  
 ![image](https://global.discourse-cdn.com/meta/original/4X/0/9/1/091c1d5a28afd7e7d214477aa06f6a75e8356355.png)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [September 13, 2023, 3:30pm UTC](https://meta.discourse.org/t/setting-up-a-support-inbox/251825/15 "2023-09-13T15:30:16Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
