Enable receiving and reply emails

I’m using NetCore Coud as an email provider but I cannot enable receiving emails or reply to emails , Any idea how can I achieve this using NeCore Cloud Email ?

1 Like

I am working with @Abdelrahman_MoHamed on this - what we believe our core issue/blocker is we are trying to configure netcore to send reply email (inbound) email to discourse for processing.

What we cannot figure out is how to get that data (the inbound parsed email) into discourse for processing, where is the configuration screen we are looking at in netcore:

We believe we would want to enter a url similar to this:

https://forum.mamapedia.com/admin/email/handle_mail

We are confused however as when we look at the webhooks setup, it appears to be POST requests…

Also, we are making the assumption that we should be using webhooks to achieve our goal.

Hi Discourse Community,

I’m working on configuring the Reply-by-Email functionality for my Discourse instance, and I need some clarification and guidance.

My Current Setup

• I’m using Netcore as my email provider.

• For incoming emails, I’ve configured a rule in Netcore to capture all emails matching the format: reply+*@mydiscourse.com.

• Netcore supports forwarding these emails to either:

  1. Another email address

  2. A webhook

What I’ve Tried

I attempted to forward these emails to the following Discourse endpoint:

https://mydiscourse.com/admin/email/handle_mail

Unfortunately, this resulted in a 404 Not Found status.

My Questions

  1. Who handles the incoming emails in this configuration? Should they be processed directly by Discourse, or does the email provider need to forward them in a specific format for Discourse to handle?

  2. I noticed there’s an option called Direct Email Receiving using mail-receiver. Would this be a better approach for my setup?

I want to ensure that the incoming emails are properly processed to enable Reply-by-Email functionality. Could you please guide me on the correct way to set this up with Netcore, or point me to relevant documentation?

Thank you in advance for your support!

1 Like

One point here, netcore is what was previously know as ‘pepipost’ - so if that rings a bell for anyone perhaps that can help point us in the right direction.

Thanks in advance!

The easiest way is Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver

I’m pretty sure the endpoint you’re using is for handling bounces, but I could be wrong.

Thanks for your reply , using this setup we will have an endpoint that we can use in the email provider to publish the data to it ?

@pfaffman very helpful, thank you. So putting aside netcore (aka pepipost) i- it sounds like you are saying if we want:

  • email sending
  • bounce management
  • reply handling

Regardless of if we use mailgun, sengrid, etc. - we have to Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver - is that correct? You say the ‘easiest’ way, so I’m curious are there other ways?

Again really appreciate the response, we were/are blocked on this now going on a few days…

Also, posting to the general community here, we are looking for a confirmation that Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver is required for full email handing on self-hosted environments.

If anyone else can confirm this is in fact required, that would be very helpful.

It’s also possible to configure a pop3 mailbox that Discourse will poll. The mail receiver is easier and allows for using arbitrary addresses for group or category mailboxes.

1 Like

Thanks you @pfaffman - again very helpful. So we are moving forward with the mail receiver, we are on a multsite install. Once we finish, assuming things go well we will check back here.

Hi @pfaffman , thanks again for your help

I have been trying to set up the Discourse mail-receiver container for my forum but have encountered an issue related to mail rejection when testing. Here are the details of the issue:

  • Forum Domain: test.mamapedia.com (proxied through Cloudflare)
  • Mail Receiver Domain: reply.mamapedia.com
  • Error Details:
    When trying to test the mail receiver using Telnet, I receive the following error:
telnet reply.mamapedia.com 25
Trying 34.122.3.90...
Connected to reply.mamapedia.com.
Escape character is '^]'.
220 ESMTP server
MAIL FROM: <abdohamoda636@gmail.com>
250 2.1.0 Ok
RCPT TO: <test@reply.mamapedia.com>
554 5.7.1 <test@reply.mamapedia.com>: Recipient address rejected: Mail to this address is not accepted. Check the address and try to send again.

Mail Receiver Logs: The mail-receiver container logs show the following rejection message:

Dec 17 17:19:12 test-discourse-20241125-173103-mail-receiver postfix/smtpd[139]: NOQUEUE: reject: RCPT from 90.3.122.34.bc.googleusercontent.com[34.122.3.90]: 554 5.7.1 <test@reply.mamapedia.com>: Recipient address rejected: Mail to this address is not accepted. Check the address and try to send again?; from=<abdohamoda636@gmail.com> to=<test@reply.mamapedia.com> proto=SMTP
Dec 17 17:19:12 test-discourse-20241125-173103-mail-receiver postfix/smtpd[139]: using backwards-compatible default setting smtpd_relay_before_recipient_restrictions=no to reject recipient "test@reply.mamapedia.com" from client "90.3.122.34.bc.googleusercontent.com[34.122.3.90]"

Observations:

  • The error message in the logs indicates that the recipient address “test@reply.mamapedia.com” is being rejected.
  • The issue seems to be related to the postfix configuration or some kind of restriction that’s preventing the mail from being accepted.

What I’ve Tried:

  1. Ensured that the DNS records (MX) for reply.mamapedia.com are correctly set up.
  2. Double-checked the configuration of the mail-receiver container and verified that the reply.mamapedia.com domain is set properly.

Mial-Receiver config file

env:
  LC_ALL: en_US.UTF-8
  LANG: en_US.UTF-8
  LANGUAGE: en_US.UTF-8

  ## Where e-mail to your forum should be sent.  In general, it's perfectly fine
  ## to use the same domain as the forum itself here.
  MAIL_DOMAIN: reply.mamapedia.com
# uncomment these (and the volume below!) to support TLS 
  POSTCONF_smtpd_tls_key_file:  /letsencrypt/reply.mamapedia.com.key
  POSTCONF_smtpd_tls_cert_file:  /letsencrypt/fullchain.cer
  POSTCONF_smtpd_tls_security_level: may


  ## The base URL for this Discourse instance.
  ## This will be whatever your Discourse site URL is. For example,
  ## https://test.mamapedia.com. If you're running a subfolder setup,
  ## be sure to account for that (ie https://example.com/forum).
  DISCOURSE_BASE_URL: 'https://test.mamapedia.com'

  ## The master API key of your Discourse forum.  You can get this from
  ## the "API" tab of your admin panel.
  DISCOURSE_API_KEY:  '#############'

  ## The username to use for processing incoming e-mail.  Unless you have
  ## renamed the `system` user, you should leave this as-is.
  DISCOURSE_API_USERNAME: system

volumes:
  - volume:
      host: /var/discourse/shared/mail-receiver/postfix-spool
      guest: /var/spool/postfix
# uncomment to support TLS
  - volume:
      host: /var/discourse/shared/standalone/letsencrypt
      guest: /letsencrypt


Cloudflare DNS records

image

image

The image shows a web page with a field labeled "A," a field for entering text, an IP address, a cloud icon indicating "Proxied," and an "Auto" button, with an "Edit" button on the right. (Captioned by AI)

I appreciate any help or insights you can provide.

1 Like

I don’t know, but such errors are always a DNS issue. And everytime when there is Cloudflare involved too. Last time, quite long time ago, I hit that escape error it was a timeout because of badly configured server.

2 Likes

I have this message when trying to send a message via telnet, but it works when I reply to notifications with my regular email providers.

I suggest you enable the reply-by-email feature and try it in the real world to see how it goes.

2 Likes

Thanks, @CocoQuark , maybe you are right, I will try to reply to any email and see and hope it works.

Will post the updates.

1 Like