Can a single Mail Receiver handle emails for all sites in a Discourse multisite setup?

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!

3 Likes

It might be sufficient to adapt this function for multisite:

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

1 Like

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

2 Likes

Sounds crazy but I can give it a try!

1 Like

I just did something similar which is working

3 Likes

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.
2 Likes

Yes, all correct.

2 Likes

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

2 Likes

It is because of this section… to make available the functionality for blocking certain domains.

1 Like

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

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

2 Likes

Yes that is correct :+1:

2 Likes

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

2 Likes

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.

5 Likes

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!

3 Likes