# Kan één Mail Receiver e-mails voor alle sites in een Discourse multisite-opstelling verwerken?

**URL:** https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667
**Category:** Support
**Tags:** mail-receiver
**Created:** [5 januari 2025 om 14:23 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667 "2025-01-05T14:23:45Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Abdelrahman\_MoHamed](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abdelrahman_mohamed/32/467712_2.png) [@Abdelrahman\_MoHamed](https://meta.discourse.org/u/Abdelrahman_MoHamed)
#### Post date: [5 januari 2025 om 14:23 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/1 "2025-01-05T14:23:45Z")

</div>

We are currently running Discourse with a multisite setup, and we plan to use the Mail Receiver for email handling. I have a question about the configuration:

Is it possible to configure a single Mail Receiver container to handle incoming emails for all forums in the multisite setup?

I want to ensure that the incoming emails are correctly routed to the appropriate forum based on their domain. Has anyone configured Mail Receiver in a similar setup?

Any guidance, examples, or best practices would be greatly appreciated!

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [5 januari 2025 om 17:35 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/2 "2025-01-05T17:35:08Z")

</div>

It might be sufficient to adapt this function for multisite:

> <https://github.com/discourse/mail-receiver/blob/9b1b99902f2d71c8d38cc85cd125af1a7388ad11/lib/mail_receiver/discourse_mail_receiver.rb#L20-L29>

---

<div class="post-metadata">

### Author: ![Abdelrahman\_MoHamed](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abdelrahman_mohamed/32/467712_2.png) [@Abdelrahman\_MoHamed](https://meta.discourse.org/u/Abdelrahman_MoHamed)
#### Post date: [5 januari 2025 om 18:47 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/3 "2025-01-05T18:47:42Z")

</div>

Thanks for sharing this , but what about the API key how will the mail receiver handle this ?

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [5 januari 2025 om 19:38 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/4 "2025-01-05T19:38:04Z")

</div>

A hacky way would be to use the same API key on every instance.

---

<div class="post-metadata">

### Author: ![Abdelrahman\_MoHamed](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abdelrahman_mohamed/32/467712_2.png) [@Abdelrahman\_MoHamed](https://meta.discourse.org/u/Abdelrahman_MoHamed)
#### Post date: [5 januari 2025 om 20:13 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/5 "2025-01-05T20:13:06Z")

</div>

Sounds crazy but I can give it a try!

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [5 januari 2025 om 20:39 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/6 "2025-01-05T20:39:57Z")

</div>

I just did something similar which is working

> [@Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver](https://meta.discourse.org/t/configure-direct-delivery-incoming-email-for-self-hosted-sites-with-mail-receiver/49487/529):
>
> On my dedicated server (running Ubuntu 22.04, with Postfix installed) I use a separate mail-receiver.yml paired to each instance of Discourse where I have enabled the mail-in posting feature. This setup creates a separate container for each instance of Discourse on my server (alongside the typical app container) which receives and processes the e-mails for its corresponding Discourse instance. Incoming emails for all of the Discourse forums on the server are received by Postfix through the sta…

---

<div class="post-metadata">

### Author: ![Abdelrahman\_MoHamed](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abdelrahman_mohamed/32/467712_2.png) [@Abdelrahman\_MoHamed](https://meta.discourse.org/u/Abdelrahman_MoHamed)
#### Post date: [6 januari 2025 om 22:03 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/7 "2025-01-06T22:03:18Z")

</div>

Thank you so much @denvergeeks for sharing this with me but I have some questions:-

1. Have you installed Postfix on your server first?
2. According to your docs I will need to create a mail receiver container for each forum right?
3. You map the domain to its corresponding forum using the transport map.
4. I see that you have made some changes to the volume mounts too.  
 ![The image shows a section of a YAML configuration file with two volume mappings related to the Discourse mail receiver. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/f/c/7/fc767409190072a1944fb88018f3e1e5fc9683ed.jpeg)

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [6 januari 2025 om 22:11 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/8 "2025-01-06T22:11:31Z")

</div>

Yes, all correct.

---

<div class="post-metadata">

### Author: ![Abdelrahman\_MoHamed](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abdelrahman_mohamed/32/467712_2.png) [@Abdelrahman\_MoHamed](https://meta.discourse.org/u/Abdelrahman_MoHamed)
#### Post date: [6 januari 2025 om 22:28 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/9 "2025-01-06T22:28:40Z")

</div>

Thanks for the confirmation, but can you explain why did you add additional volume because I see both are even different from the default one

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [6 januari 2025 om 22:44 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/10 "2025-01-06T22:44:13Z")

</div>

It is because of [this section](https://meta.discourse.org/t/configure-direct-delivery-incoming-email-for-self-hosted-sites-with-mail-receiver/49487#block-unwanted-domains-from-sending-to-you-8)… to make available the functionality for blocking certain domains.

---

<div class="post-metadata">

### Author: ![Abdelrahman\_MoHamed](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abdelrahman_mohamed/32/467712_2.png) [@Abdelrahman\_MoHamed](https://meta.discourse.org/u/Abdelrahman_MoHamed)
#### Post date: [7 januari 2025 om 09:12 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/11 "2025-01-07T09:12:15Z")

</div>

Greate, one last question .

Should I create a new path for each mail receiver for example I have about 10 forums so I will need to create new volume for each one od them like this

```plaintext
Default forum:

- volumes:
      host: /var/discourse/shared/mail-receiver/postfix-spool
      guest: /var/spool/postfix

First forum:

- volumes:
      host: /var/discourse/shared/mail-receiver-1/postfix-spool
      guest: /var/spool/postfix

Second forum:

- volumes:
      host: /var/discourse/shared/mail-receiver2/postfix-spool
      guest: /var/spool/postfix

```

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [7 januari 2025 om 09:21 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/12 "2025-01-07T09:21:30Z")

</div>

Yes that is correct 👍

---

<div class="post-metadata">

### Author: ![Abdelrahman\_MoHamed](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abdelrahman_mohamed/32/467712_2.png) [@Abdelrahman\_MoHamed](https://meta.discourse.org/u/Abdelrahman_MoHamed)
#### Post date: [7 januari 2025 om 09:33 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/13 "2025-01-07T09:33:33Z")

</div>

Really appreciated, I will start the implementation and keep you updated

---

<div class="post-metadata">

### Author: ![Abdelrahman\_MoHamed](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abdelrahman_mohamed/32/467712_2.png) [@Abdelrahman\_MoHamed](https://meta.discourse.org/u/Abdelrahman_MoHamed)
#### Post date: [7 januari 2025 om 11:41 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/14 "2025-01-07T11:41:09Z")

</div>

Hi @denvergeeks

Thanks to your support, I’ve gained a much clearer understanding of how to proceed. I admire the way you generously share your knowledge, and I’m grateful to be part of such a collaborative community it’s working now.

I do have a quick follow-up question: Is there any additional configuration or best practices you’d recommend for enhancing security in this setup?

Thanks again for your support—it means a lot to me!

Looking forward to hearing from you.

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [7 januari 2025 om 13:45 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/15 "2025-01-07T13:45:53Z")

</div>

> [@Abdelrahman\_MoHamed](#):
>
> Is there any additional configuration or best practices you’d recommend for enhancing security in this setup?

Not that I know of but, I agree with you, that is the next question for which I hope we’ll get some guidance from the community!

Great work! I really appreciate your postings about your progress and results as well - it is a really nice validation and reward for my efforts in sharing!

---

<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: [6 februari 2025 om 13:45 UTC](https://meta.discourse.org/t/can-a-single-mail-receiver-handle-emails-for-all-sites-in-a-discourse-multisite-setup/345667/16 "2025-02-06T13:45:54Z")

</div>

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