Code for receiving emails via Discourse API

Hello Discourse,

Is there a preexisting code base out there for pushing emails to Discourse’s incoming email API?


From the output of rake routes You can send a POST request to


Here is the controller method from handle_mail:


For a non-technical user I’d need to understand the capabilities of inbound email via API:

What I’ve done already:

  • Inbound Emails via POP3 polling to main domain (not subdomain)
  • Working inbound email via the postfix mail module but that only works for subdomain - in my case, - which we can not use, need primary domain.

Current Setup:

  • Inbound email: G Suite Google “Groups” email address forwarding to free Gmail accounts (to avoid paying for a Gsuite account per email address). POP3 polling
  • Outbound email: SMTP Relay Forwarding via GSuite validated by the IP of my Discourse server install on Google Cloud.

This works but the free Gmail pop3 polling accounts is something I’d like to get away from.

We plan to use the Google Cloud Platform Email API to handle email in-out ideally for larger scale deployment and service.

Where is the documentation I could send my tech employees on how to get inbound email going directly to discourse?

If that is already linked in the post above then thank you. Otherwise my guess is there needs to be a greater contextualized explanation.

1 Like