I have set up our mail server to forward mails to our Discourse using HTTP through the API, and that works. I now want to enable reply_by_email so that users can respond to messages directly.
I’m thus trying to enable reply_by_email in the Rails console, but Discourse rejects my request:
discourse(prod)> SiteSetting.reply_by_email_address
=> "reply+%{reply_key}@<our-valid-domain>.de"
discourse(prod)> SiteSetting.email_in
=> true
discourse(prod)> SiteSetting.reply_by_email_enabled = true
lib/site_settings/type_supervisor.rb:271:in `validate_value': reply_by_email_enabled: You must enable either manual, POP3 polling or have a custom mail poller enabled before enabling reply by email. (Discourse::InvalidParameters)
from lib/site_settings/type_supervisor.rb:177:in `to_db_value'
from lib/site_setting_extension.rb:623:in `add_override!'
from lib/site_setting_extension.rb:990:in `block in setup_methods'
from (discourse):15:in `<main>'
I’d start with this part of the response you received: You must enable either manual, POP3 polling or have a custom mail poller enabled before enabling reply by email
That makes it sound like maybe you haven’t set up POP3 or mail-receiver before trying this. (You probably want mail-reciever.)
I’m not even sure where you might have found those Rails commands, because both of those processes would have you use the Admin site settings:
That is correct - I have set up neither but set up our Postfix mail server to forward emails to Discourse through its API. I’m not sure if that is a supported configuration, but I’d really like to avoid running another email server (mail-receiver) if I can.
I do not find the “Reply by email enabled” setting in my admin section:
I use mail-receiver myself, so a Postfix+API setup is beyond me, but note that the screen you’re on is a subsection just for “emails that are sent to your members.”
The settings I mentioned for reply-by-email are found in Admin → All site settings → Email:
The “Manual polling enabled” setting is also found under Admin → All site settings → Email.
And since I apparently can’t sleep, I did some digging around and saw precious few cases of people trying to configure email-in via API. In case it’s any use to you as you proceed, here’s what I found:
(bunch of links)
As I searched, Discobot surfaced this perhaps outdated info:
You can use the Discourse API to handle incoming emails without relying on the mail-receiver container. The /admin/email/handle_mail endpoint accepts raw email content via POST, allowing you to push emails directly to Discourse using a script or custom integration. This method bypasses the need for SMTP polling or the mail-receiver container entirely.
For example, you can send an email to Discourse using a curl command with the email parameter containing the raw email content. This approach is commonly used in custom email delivery setups, especially when using services like AWS Lambda or other serverless functions.
(…I found nothing about it in the API documentation.)
2018: This topic didn’t seem to have a resolution.
2018: This post refers to an email guide – referencing language that no longer exists there – and also recommends: “Easiest way to get reply by email working is to use the mail-receiver container template, rather than trying to work with all sorts of varying APIs from the different providers.”